Issues spotted with 2022.1.3 to flag up

Hi there - I’ve reported a bug regarding expInfo not closing correctly when no parameters at ExpInfo array not closed properly when no properties set in builder · Issue #4799 · psychopy/psychopy · GitHub - though during testing of 2022.1.3 on a Windows 10 machine, I also spotted other issues which I thought I’d share here first and check if they need submitting as bugs:

1) Working on online experiments built in 2021.1.4 and not opening when clicked directly to load in 2022.1.3

Older experiments with a pre-existing Pavlovia .git project already present will not always open directly for some reason. Starts to load up PsychoPy, and then just dies with no error messages (even when running via CMD). I can however open up the experiment by opening PsychoPy builder first, and then opening via the file menu.

If I delete the .git folder, then the experiment will load up when the file is clicked on directly.

2) Experiments without loops will give a currentLoop handler error

I noticed that if you push an experiment without a loop online (i.e. one routine with a text + keyboard component), you get a “ReferenceError: currentLoop is not defined”

The simple workaround is to add a loop round at least one single element with 1 rep, or make sure any response components are not saving data if you don’t have any actual trial loops in your experiment. Seems to be a currentLoop handler that has been added to trialRoutineEnd() that is causing the issue.

3) Javascript being pulled into Python code generation

If you have an old script (i.e. written in 2021.1.4 like myself) that had a code block just set to “JS” only, then trying to run locally in the new version will flag up a Python script error, as it oddly puts the Javascript code into the Python output generated when you run.

If this happens to anyone, the quick fix is to change the code block to “Both” (leaving the Python side blank). After you’ve saved and ran at least once, then you should be able to safely put it back to “JS” and it works fine after that.

4) Online scripts no longer look inside /resources directory

I don’t think this is an issue, and its just part of the new way v2022 manages resources. However, rather than just making sure that all your stims are put within the resources sub directory, you must now specify them via the experiment settings or via the resource management block. Doesn’t seem to look inside /resources at all now, so any old online scripts need to have the resources correctly set up from now on if you upgrade.

5) Syncing with a pre-existing online script written in an older version

I have a number of online experiments running that were built in 2021.1.4. I opened up a few of those experiments in 2022.1.3 and then made a small change and tried to sync as a test.
PsychoPy doesn’t see that it is a pre-existing project, and tries to create a new one.

Seems like if you move major versions, then you may have to re-create the project on Pavlovia - unless there is another step to work around this?


Hope this is useful, and anything that needs moving to github as a bug report, please let me know.

2 Likes

Thanks for spotting all this!

1) Working on online experiments built in 2021.1.4 and not opening when clicked directly to load in 2022.1.3

This is interesting - when opening from a file click, it should just open the app and then call the same fileOpen method as when you open a file by dragging onto the window. If it’s only breaking when opening a file directly, I would guess that there’s something in that direct opening code that shouldn’t be there… Will investigate!

2) Experiments without loops will give a currentLoop handler error

I think this one should be fixed by this PR: BF: Get current loop during run rather than in boilerplate by TEParsons · Pull Request #4787 · psychopy/psychopy · GitHub

Essentially, we were trying to get the containing loop for a component when writing the JS code, but as JS is non-linear we can’t rely on the same process as Python to get this loop, so we need to instead store the current loop as the experiment runs.

3) Javascript being pulled into Python code generation

I’m having trouble recreating this, could you share the experiment file that you’re having the issue with?

4) Online scripts no longer look inside /resources directory

You’re right, this is a change in behaviour more than an issue in-and-of itself, although if the resources folder is inside the experiment folder then any components referring to e.g. resources/image.png should still be added to the resources dict when the PsychoJS experiment begins, as should be the case with any sub-folder. Whipping up a quick experiment to test this seems to work:
testJSres.zip (17.2 KB)

5) Syncing with a pre-existing online script written in an older version

PsychoPy checks for existing projects by reading the file projects.json in your user folder (under the sub-folder “pavlovia”), so it should still recognise old projects… I’ll look into why it would be missing them! One simple workaround to save fully recreating the project is just to navigate to the project via the :pavlovia_search: search interface and set the Local Root field to be the folder where the project is stored on your machine. Could you try this with one of your projects and let me know if it works?

Thanks for the response and taking a look at each of the issues flagged. To respond to the last 3:

  1. I can’t seem to replicate this again either. I’m wondering if it was a script that had been written in 2020.1.3 (which is the version we fixed on for 2020/21 academic year, with 2021.1.4 fixed on for 2021/22). Will check this now. EDIT: Worked fine, so i’m unsure what happened to trigger it. If I chance across it again, then I will report here. It seems to be a rare combination of events that triggers it anyway and isn’t a major issue.

  2. If the resource is directly referenced in a component (complete physical path to /resources/image.png etc), then that is fine. If you however determine a stimulus path to a file via code and then feed that variable into a resource, then it can’t find it like it used to in 2021.1.4 (as that used to scan all of the resources directory and load anything found within it). But again, I think that’s fine - its just how the process has changed for managing resources not directly pointed to within the resource properties (i.e. stored in a variable via a code block).

  3. Something I should have mentioned, but I had hoped to use that very workaround to point to a different local folder - however, it doesn’t show my own projects on the list to select from. It’s completely blank. I had wondered if this was because it only shows projects which are “Public” rather than “Private”? I only have projects set to Private at the moment. (see below for blank image)

I think the projects not showing up in Me Mode is linked to the issue this PR will fix:

You’re spot on that it’s because it only shows public projects - but it should show private projects too so long as you’re logged in and have access to them, the problem is that the oauth token wasn’t appended correctly so they weren’t appearing.

1 Like

Your first issue could also be related to the following issue I submitted at Github, although I am not sure whether TParsons PR might also tackle this issue in a different way:

1 Like

Ah that’s great to hear. We’ve had to fix on 2022.1.3 for this academic year (had to make a decision by a certain date sadly), but its good to know there will be a better workaround longer term. For now we’ll likely just delete and re-create the project (preserving the data first etc).

I think BUG 2: could be it. Recently I had to rebuild my workstation, and probably lost the appdata files as a result. The project sync folders for the experiments out were on a separate drive that was preserved.

Hi!

I am still encountering Problem #2 (Experiments without loops will give a currentLoop handler error) in version 2023.2.3, except my project has several loops. I’ve still added a loop around the entire project as that was suggested elsewhere too, but it has not resolved the issue. I’m trying to apply the solution suggested by TParsons but I am unsure how to implement this in my code as I am not fluent in Python. I’m also unsure if this work around is still applicable for the later version I’m working in?

Any insights someone can provide would be much appreciated. Thanks in advance!