psychopy.org | Reference | Downloads | Github

Reading .psydat files

Hello,

Using the builder interface I created an experiment presenting several QUEST staircases interleaved.

I would like to use .psydat files to get parameters from the psychometric function, but when I try to read the .psydat file, I get the following error:

In [64]: thisDat = fromFile(thisFileName)
Exception AttributeError: "'ExperimentHandler' object has no attribute 'dataFileName'" in <bound method ExperimentHandler.__del__ of <psychopy.data.ExperimentHandler object at 0x0D260F50>> ignored

It seems reading .psydat files is not very popular, but would anyone know how to solve this?

Many thanks in advance,
Gijs

Here’s the full error output:

In [64]: thisDat = fromFile(thisFileName)
Exception AttributeError: "'ExperimentHandler' object has no attribute 'dataFileName'" in <bound method ExperimentHandler.__del__ of <psychopy.data.ExperimentHandler object at 0x0D260F50>> ignored

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-64-e417468c1c34> in <module>()
----> 1 thisDat = fromFile(thisFileName)

C:\Python27\lib\site-packages\psychopy\tools\filetools.pyc in fromFile(filename)
     28     """
     29     f = open(filename)
---> 30     contents = cPickle.load(f)
     31     f.close()
     32     #if loading an experiment file make sure we don't save further copies using __del__

C:\Python27\lib\copy_reg.pyc in _reconstructor(cls, base, state)
     46 def _reconstructor(cls, base, state):
     47     if base is object:
---> 48         obj = object.__new__(cls)
     49     else:
     50         obj = base.__new__(cls, state)

TypeError: ('object.__new__(X): X is not a type object (classobj)', <function _reconstructor at 0x0255B430>, (<class psychopy.contrib.quest.QuestObject at 0x0546CD88>, <type 'object'>, None))

Hi, this is weird. Which version of PsychoPy did you use to create those files, and which version are you using to load them? Can you provide a minimal example to reproduce the problem? (Create an ExperimentHandler, add a QuestHandler to it, save the psydat pickle, try to load it.) Or, alternatively, share one of your psydat files with us (if you don’t want to do this publicly on the forum, you may email it to me – richard.hoechenberger@gmail.com.)

I wouldn’t say the psydats are particularly unpopular – I, for one, use them all the time – but it’s simply easier for most users to just use CSV files instead.

We should probably offer a JSON output format as well, to increase interoperability. (Although that may not be trivial, because not all objects can be easily serialized.)

Thanks,

Richard

Hi Richard,
Thanks, it was a version problem. I used builder version 1.84 to create, and 1.80.06 to open via ipython. After updating to 1.84 I can now read .psydat files without problem.

Thanks again!
Gijs

1 Like