Commented out code still run

OS (e.g. Win10): Win 11
PsychoPy version (e.g. 1.84.x): 2024.2.1post4
Standard Standalone? (y/n) y
What specifically went wrong when you tried that?:
So, I’ve been having a problem that every time I run print something in a code component, the code is permanently there. Even if I comment out the code or even delete it, the same print statement still runs, and the message is still printed out to the Runner console. I have tired restarting Psychopy or the computer and the problem still persist. Is there anyway to actually remove that code?

Are you running this locally or online? Both reasons I can this of for this symptom only affect the behaviour online.

Only locally :smiling_face_with_tear: Do you mind sharing your insight anyway? Thank you!

Online you often need to flush the cache (with Ctlr-Shift-R) or use an incognito tab to see the latest changes.

I’ve also sometimes make the mistake of making an edit on the Python side of a code component and forgetting it’s set to Both so the JS side doesn’t update.

I’ve just checked and running a PsychoPy experiment from the Runner still runs the latest version so long as it has been saved.

The only thing I can think of is that because you are using a version with post in the version number, the python file being created isn’t the one being run. Please could you show your experiment folder with file dates?

Yes! What exactly do you want to see? Would a screenshot be enough?

Yes please. I’m interested in the names of the files and the file dates for a folder where old code is apparently being run. Please could you also show your code component with the commented out code?

I was able to fix the problem by “save as” the experiment in a new folder. I guess Psychopy doesn’t recreate some Python code unless you save a copy and then run the copy to force it to recreate the Python scripts. Thank you for the help!