Local 'lastrun.py' file fails to update and prevents task running

MacOS Catalina 10.15.6:
PsychoPy version2020.2.10:
**Standard Standalone? y
What are you trying to achieve?:

I’ve been working on a project for a while on builder which I have successfully used online through Pavlovia multiple times. However, recently the .psyexp local file has been corrupted such that every time I try and run it, an old bit of javascript code pops up in my compiled python script and causes the code to crash. Specifically, the error I get is:
File “/Users/eleanorholton/Documents/GitHub/goalmaintenance/task/submarineTask_fixBug_lastrun.py”, line 3975
if (psychoJS.eventManager.getKeys({keyList:[‘q’]}).length > 0) {
^
IndentationError: unexpected indent

However this piece of javascript which was inside a JS code snippet has been deleted from the builder. Only whenever I try to run it or compile the python script, the line re-appears inside the python script. However, when I compile it to javascript the line is correctly deleted. It seems that the lastrun.py script fails to update given the edits I’ve made to the builder, and prevents it from running.

What did you try to make it work?:
Things I’ve tried:
-Deleting and re-compiling all the python and js scripts
-Renaming the .psyexp script and saving it to a different folder
-Downloading my psyexp script from pavlovia again, and saving to a new folder

What specifically went wrong when you tried that?:
Every time, when I recompile the script to python, that line of code re-appears. A similar problem is mentioned in a comment section on a previous page, but their fix (renaming the file) doesn’t seem to work for me.

1 Like

Same problem in just changing anything in builder. Won’t update anymore. Only old file shows up in coder. Try to save as something else and won’t run because it wants a last run file it won’t create. Seem to have stuffed up preferences but tried every combination and nothing works to get anything updated anymore. All changes saved in builder, from close to reopen, but nothing changes in script, just keeps stuff that isn’t in builder anymore.
Found could get script updated with Compile (F5), can see changes in Coder, but still only runs old script from Builder and Coder. Try to delete last run file and won’t run at all. Tried complete uninstall and reinstall but still does the same, won’t run with any saved edits any which way

1 Like

Same problem recently here: PsychoPy not creating lastrun file

1 Like

Did you solve this? I’m experiencing this too. I’m deleting components in the builder, deleting previous py files and running but the old code remains in the generated python code.

Personally, only solution found was to start all over again. New install, new folder, etc… Same “solution” that sadly concluded the other thread on this topic (PsychoPy not creating lastrun file)

I am having the same problem, which has been driving me nuts for days. I have taken a programme from an older version in Psychopy and tried to rerun it in the latest version of Psychopy, it works, then I go about adding what I need for this experiment and the failure to create a new *.lastrun file starts all over again…

I suspect that the lastrun.py file won’t update if your script contains a serious Python error. Are you seeing any error messages anywhere?

Do you have any JS code components which are actually hiding some Python code? Setting them to Both and checking all the tabs can help.

Thank you for the suggestions! There is a fair bit of code in my experiment, I am currently combing through it as you suggested - and deactivating it to see what runs.

But essentially, if I do anything to the older experiment programmed in an earlier version of Psychpy, then the new version won’t run. So just simply adding a text box to appear for a few seconds, it won’t display and update into the file lastrun.

However, I did what you suggested, and there are many errors, mostly this kind of thing:
4.9348 WARNING Parameter ‘Data file delimiter’ is not known to this version of PsychoPy but has come from your experiment file (saved by a future version of PsychoPy?). This experiment may not run correctly in the current version.
4.9350 WARNING Parameter ‘Resources’ is not known to this version of PsychoPy but has come from your experiment file (saved by a future version of PsychoPy?). This experiment may not run correctly in the current version.
Parameter ‘colorSpace’ is not known to this version of PsychoPy but has come from your experiment file (saved by a future version of PsychoPy?). This experiment may not run correctly in the current version.
4.9446 WARNING Parameter ‘letterHeight’ is not known to this version of PsychoPy but has come from your experiment file (saved by a future version of PsychoPy?). This experiment may not run correctly in the current version.
4.9447 WARNING Parameter ‘readOnly’ is not known to this version of PsychoPy but has come from your experiment file (saved by a future version of PsychoPy?). This experiment may not run correctly in the current version.
4.9447 WARNING Parameter ‘styleTweaks’ is not known to this version of PsychoPy but has come from your experiment file (saved by a future version of PsychoPy?). This experiment may not run correctly in the current version.

Don’t worry too much about those warnings. They shouldn’t stop it running. Are there any errors?

What version is it coming from and going to?

I am going from the version from one year ago (I think it was 2020.1.3.) to 2021.1.4.

I am also not seeing any errors, it just won’t update the lastrun file, if I delete this I get the error that the lastrun file can’t be found. So it is not creating or updating a new one, if I touch the old programme.

Your warnings look more like you are trying to open a 2021.1.4 experiment in 2020.1.3. You could experiment with use PsychoPy version under Experiment Settings.

Well, that was daft of me (the most politically correct word I can think of right now) … I had neglected to change that there… I didn’t realise that it stayed with the default version.

Refreshingly, it has thrown up a whole bunch of new errors which are ones that I can work with. So thank you very much for your help - I should be fine to carry on as usual now.

(And thank you also for your cribsheets, without which the likes of me would have given up long ago!).

1 Like