Hi,
I run an experiment with Psychopy 1.83.1 and I'm actually looking at the data I recorded. I'm working with python and Jupyter.
When I try to open a single .psydat file I'm able to see the data I recorded and work on it.
However I need to use a routine to work on all the data of my participants togheter. Specifically I'm using the following script to save the data in a dict in order to work on it:
data_cntr ={}
for subject in range(1,13):
print 'cntr= ',subject
try:
datFile_blocks = fromFile('C:\\Users\\Roberta\\Desktop\\analysis\\data_Spain\\psydat\\blocks\\blocks_c00'+str(subject)+'.psydat')
for trial in range(len(datFile_blocks.entries)):
if trial == 0: block = 'meta'
block = 0
img_block = 0
if 0 < trial < 19:
block = ''
img_block = '1'
if 19 < trial < 38:
block = '_2'
img_block = '2'
try:
img = datFile_blocks.entries[trial]['Images'+img_block]
cond = datFile_blocks.entries[trial]['cond']
ar = datFile_blocks.entries[trial]['Arousal'+block+'.response']
vl = datFile_blocks.entries[trial]['Valence'+block+'.response']
dm = datFile_blocks.entries[trial]['Dominance'+block+'.response']
eyes = datFile_blocks.entries[trial]['eyes data']
eda = datFile_blocks.entries[trial]['eda']
ecg = datFile_blocks.entries[trial]['ecg']
if block not in data_cntr.keys(): data_cntr[block] = {}
if img not in data_cntr[block].keys(): data_cntr[block][img] = {}
if 'cond' not in data_cntr[block][img].keys(): data_cntr[block][img]['cond'] = []
if 'ar' not in data_cntr[block][img].keys(): data_cntr[block][img]['ar'] = []
if 'vl' not in data_cntr[block][img].keys(): data_cntr[block][img]['vl'] = []
if 'dm' not in data_cntr[block][img].keys(): data_cntr[block][img]['dm'] = []
if 'eyes' not in data_cntr[block][img].keys(): data_cntr[block][img]['eyes'] = []
if 'eda' not in data_cntr[block][img].keys(): data_cntr[block][img]['eda'] = []
if 'ecg' not in data_cntr[block][img].keys(): data_cntr[block][img]['ecg'] = []
data_cntr[block][img]['cond'].append(cond)
data_cntr[block][img]['ar'].append(ar)
data_cntr[block][img]['vl'].append(vl)
data_cntr[block][img]['dm'].append(dm)
data_cntr[block][img]['eyes'].append(eyes)
data_cntr[block][img]['eda'].append(eda)
data_cntr[block][img]['ecg'].append(ecg)
except:
pass
except:
print 'none'
I have similar code for acontrol group and a clinical group, for blocks data and baseline data.
When I run the whole code I get this error:
Exception AttributeError: "'ExperimentHandler' object has no attribute 'dataFileName'" in <bound method ExperimentHandler.__del__ of <psychopy.data.ExperimentHandler object at 0x26C65470>> ignored
The strange thing is that if I run only some of the files or only part of the script it doesn't happen. Thinking that the problem was with some of the files, I checked file by file and I have no problem to open single files, except for one of them. In this case I get the same error:
Exception AttributeError: "'ExperimentHandler' object has no attribute 'dataFileName'" in <bound method ExperimentHandler.__del__ of <psychopy.data.ExperimentHandler object at 0x2AF8D850>> ignored
---------------------------------------------------------------------------
EOFError Traceback (most recent call last)
<ipython-input-15-cac711417e75> in <module>()
----> 1 datFile= fromFile('C:\\Users\\Roberta\\Desktop\\analysis\\data_Spain\\psydat\\blocks\\blocks_c001.psydat')
C:\Program Files (x86)\PsychoPy2\Lib\site-packages\PsychoPy-1.83.01-py2.7.egg\psychopy\tools\filetools.pyc in fromFile(filename)
32 """
33 f = open(filename)
---> 34 contents = cPickle.load(f)
35 f.close()
36 #if loading an experiment file make sure we don't save further copies using __del__
EOFError:
First of all I'm not sure if the problem is related to how I open the file or how I save the data.
In the second case, I can modify my script for the next experiment but how can I deal with this problem now?
I hope that someone can help me!I can provide more information if needed!
Thank you in advance!
ROb