psychopy.org | Reference | Downloads | Github

Overwrote experiment file with python script


#1

Hi everyone!

I tried to open my experiment and received the following error:

v1.90.0

Traceback (most recent call last):
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy\app\builder\builder.py”, line 1589, in fileOpen
self.exp.loadFromXML(filename)
File “C:\Program Files (x86)\PsychoPy2\lib\site-packages\psychopy\experiment_experiment.py”, line 436, in loadFromXML
self._doc.parse(filename)
File “C:\Program Files (x86)\PsychoPy2\lib\xml\etree\ElementTree.py”, line 656, in parse
parser.feed(data)
File “C:\Program Files (x86)\PsychoPy2\lib\xml\etree\ElementTree.py”, line 1642, in feed
self._raiseerror(v)
File “C:\Program Files (x86)\PsychoPy2\lib\xml\etree\ElementTree.py”, line 1506, in _raiseerror
raise err
ParseError: not well-formed (invalid token): line 1, column 0

I understand this is because I saved it from the Coder view and overwrite the experiment file. I can run the experiment using the experiment_lastrun.py file, but is there any way I can retrieve the builder view?

Any help is much appreciated.

Thanks,
Olivia


#2

Hi @oliviad. Have you tried restoring the file? Right click the file you saved over, go to Properties > Previous Versions then select the file version you want to restore, and click “Restore”.


#3

Hi,

I tried doing that and it says there are no previous versions. I’m not sure why that is, as I have been working on it for a while.


#4

Ok, how did you save the file? Did you save the code from the coder view with a .psyexp extension to the file?


#5

Hi David & Olivia,

Also note this post from @jon in the other thread re the possibility of reconstruction from the .psydat file (new to me):


#6

The facility where the experiment gets saved inside the psydat data file was turned off for most recent versions*

The options here would be:

  1. as David suggests, to fetch an older version if there’s any form of backing up on the computer (dropbox and windows, for instance both include backing up systems but on windows I think that requires the user to set it up manually)
  2. change the file extension of the script to .py and run as a Python script instead of a Builder experiment

Olivia, please upload one of your previous .psydat files and the current (broken) .psyexp file to see which of these solutions will work.

cheers,
Jon

* for a while it was causing problems with unicode inside the experiments but I think that’s fixed now, so we should probably reactivate the system


#7

experiment.psyexp (45.0 KB)

I can upload the .psyexp file, but it won’t let me upload the .psydat file


#8

In fact, I have now managed to restore a previous version through the OneDrive website. I’m not exactly sure how I saved it.


#9

That psyexp file was completely empty, so I don’t know that happened either. Glad you fixed it using OneDrive. (Good idea to keep important files in OneDive or Dropbox for exactly this reason)

Out of interest, what version of PsychoPy were you using?


#10

It’s with v.1.90.0


#11

OK, I really don’t have a clue how that would have been possible from within PsychoPy