Data saves when running through Psychopy Coder (in both a log and the downstream csv), but when running my scripts through the Terminal with pythonw myscript.py
, I get the error below.
File "netlearn_kids_v1.py", line 90, in <module>
fulltask()
File "netlearn_kids_v1.py", line 83, in fulltask
do_runtrials(subj_id,trials,logname.replace('.csv','_run1.csv'),1)
File "/Users/utooley/Dropbox (Personal)/psychopy/netlearn_kids_v1/pretask.py", line 167, in do_runtrials
trials.saveAsText(fileName=logname, delim=',', dataOut=('all_raw'), appendFile=False)
File "/Users/utooley/anaconda/lib/python2.7/site-packages/psychopy/data/base.py", line 206, in saveAsText
matrixOnly=matrixOnly)
File "/Users/utooley/anaconda/lib/python2.7/site-packages/psychopy/data/trial.py", line 401, in _createOutputArray
dataOut, dataAnal, dataHead = self._createOutputArrayData(dataOut)
File "/Users/utooley/anaconda/lib/python2.7/site-packages/psychopy/data/trial.py", line 489, in _createOutputArrayData
dataType, analType = thisDataOut.rsplit('_', 1)
ValueError: need more than 1 value to unpack
The relevant code:
tidx = 0
for tidx, trial in enumerate(trials):
#do some stuff
logging.log(level=logging.INFO, msg="Trial %i - Stimuli1 %s - Stimuli2 %s" % (tidx+1, trial['path1'], trial['path2']))
#Set values for trial
onset = globalClock.getTime()
trials.data.add('onset', onset)
rt=None
Pressed=False
#while not mouseclick.getPressed():
#while globalClock.getTime() < (tidx+1)*trialDur:
while not Pressed:
background_image.draw()
imgL.draw()
imgR.draw()
win.flip()
mouseclick=mymouse.getPressed()
#key=event.getKeys(keyList=('escape'))
if sum(mouseclick)>0:
rt=globalClock.getTime()-onset
core.wait(.1)
Pressed= True
event.clearEvents()
trials.data.add('rt',rt)
logging.log(level=logging.INFO, msg="*** END ****")
trials.extraInfo['END']=globalClock.getTime()
trials.saveAsText(fileName=logname, delim=',', dataOut=('all_raw'), appendFile=False)
Any thoughts on the issue? I just updated standalone psychopy to 1.90.2, but I believe when I run from the terminal I’m using Psychopy installed using pip
, I get PsychoPy 1.85.6 <pip>
in my list of environment packages. I’m on OS X 10.11.6.
Update: after updating to standalone 1.90.2, I now get the same error when running from the Coder.