Coder View in Mac (v2025.1.1) not working as expected

If this template helps then use it. If not then just delete and start from scratch.

OS (e.g. Win10): MacOS 15.0.1
PsychoPy version (e.g. 2024.2.4 Py 3.8): v2025.1.1
Standard Standalone Installation? (y/n): y

What are you trying to achieve?:

I am trying to edit an existing PsychoPy project on the application. I downloaded PsychoPy and am trying to open the Coder view but when I do click on it, it opens a blank project/page and not the current project I have open. When I double-click the project from Coder view, it opens up in Builder view. I am pretty new to PsychoPy so I wanted to ask, do I need to have the python files in order to use coder view?

Below is a picture of what happens when I double click the psyexp file. Builder view is opened and I cannot see the python code of the experiment.

I have not been able to find this on another thread and am not entirely sure if it’s an issue or perhaps something I am missing. I would appreciate any help. Thanks very much!

Press this icon to compile your Builder file and open it in Coder.

However, I would not recommend editing a Builder experiment in Coder.

Thank you so much for your help! If you don’t recommend using Coder for experiments developed using Builder, would you be able to let me know how I can edit the duration of each of my experiment blocks in builder view (or point me in the direction of a helpful thread/instruction guide). I have had trouble finding one. Again, not sure if my question is too vague as I am new to PsychoPy so please let me know if you need more details and I will do my best.

Thanks again for your help!

Please clarify. Do you mean routine duration or exiting a loop early? What sort of code were you thinking about adding?

The experiment I am trying to edit has 4 experimental blocks (e.g. A - B - C - D) and this repeats 4 times. Each block (e.g. A) has a duration of 10 minutes. I wanted to try both of the following:

  1. Changing the experiment so that each block runs for 5 minutes instead of 10 minutes.
  2. Making it so the experiment repeats 3 times instead of 4 times.

I was wondering if you would know how to do either (or both) from the builder view.

I’m not sure if this helps or adds more context but below is part of the flowchart of the experiment where you can see the first block (AXCPT) and the second block (NBack) with breaks and instructions in the middle:

Again, apologies if this is a bit vague but if I can provide any more clarification, I would be happy to do so. Thanks!

If it currently runs for 10 minutes, that’s probably in a code component somewhere. I would start a clock in Begin Experiment (myClock = core.Clock()) then reset it before the loop starts in End Routine (myClock.reset()) and then check it at the end of each loop (e.g. End Routine in feedback).

if myClock.getTime() > 300:
     loopName.finished = True # Change loopName to the current loop name

How does the experiment repeat? I can’t see an outer loop. Maybe whoever wrote it just made a very long flow.

Thank you! That makes sense and I will look out for this in the Python code. I did have a follow up question. I noticed that when I click the button you mentioned to get the ‘Coder’ version of the experiment, that it creates a separate python file of the experiment. If I were to make changes to this file, are they also applied to the .psypexp file that already exists? I am asking because this experiment uses Pavlovia and in the original zip folder, there was no python file with the experiment, just the .psypexp file so I was wondering how this would work with the new python file created (or whether I can remove it once I have made the appropriate changes).

Also, you’re correct! My screenshot did not show it but they ended up using a very long flow. Thanks for the additional context.

No, which is why I discourage editing the Python file directly.

When you run a Builder experiment the first step is that it generates a Python file (lastrun.py) and then runs that. I sometimes generate the Python file from that icon to help with debugging, but I never run an experiment from it.

Got it, thanks for the clarification. I have a follow up question. If I did want to change the time it runs from (e.g. from 10 minutes to 5 minutes) , then I would only be able to edit this in the builder version of the code? Would you be able to let me know how to do this or if there’s a resource I could use as I have been having trouble finding one. Thanks again for your help!

Try searching for 600 via Edit / Find in Experiment to locate the current code.

There should either be a variable set to 600 or a component duration or a comparison with t or a clock in Each Frame.

Hi again, thanks very much for your help!

I was able to find a piece of code that had 600 and I modified it for my testing. I’ve included it below for context:

if ((loopTimer.getTime() > 60)) {
currentLoop.finished = true;
}

I also made changes to the workflow (removed a particular block) and saved the psyexp file in the builder mode. I pushed this version of the code to GitLab so I could run it in Pavlovia but my changes were not reflected (for example, the part of the workflow I deleted is still there and the experiment blocks ran for longer than 60 seconds.

I wanted to ask if you might know why this is happening or how I may fix it? I see that the file is saved and that the changes are reflected when I reopen the file in PsychoPy so I’m not sure what the issue might be. Thanks again.

Thank you! I tried both clearing my cache and running it on incognito but neither worked. It seems like the changes are not being reflected at all, as I uploaded this version as a new project in Pavlovia (that has not been run before). For the steps I took, I made the changes and then saved the file. The time at which the .psyexp file was edited also reflects that a change was made and when I open the file, it has the changes reflected too.

However, it seems that perhaps the changes aren’t actually being applied to the .psyexp file. I will take a look on this forum to see if anyone had similar problems but wanted to ask if you might know why this is the case?

Thanks for your help.

Edit: In case you would like additional context, the changes I made are below highlighted in pink (changing timer to 60 and removing the first few blocks from the workflow).

Here is a link to the experiment: Eleanor Hassan / mental-fatigue-battery-testing-session · GitLab

If you edit the psyexp file and then reopen it do you see the changes?

The Git repository hasn’t bee updated in 3 years.

Also:

Sorry for the confusion. The repository I linked is of the original experiment but here is my (modified) version - Varsha Kumar / mental-fatigue-modified · GitLab

As for your second point, I’m not certain I’m following entirely. I don’t see an Experiment Settings / Online / Output path and there is no folder created in local output path because this program has been designed to run only on Pavlovia from my understanding, and not on PsychoPy (the author mentioned that it would need modifications to be run on PsychoPy).

However, I did go to the html folder in my repository and saw that in there are 2 javascript files that both still have the original workflow and time (600 seconds). Could this be what is causing this issue and do I need to change these files as well?

You should not have an html folder.

Your repository suggests that you are using version 2020.2 but there is only an initial commit, so you perhaps haven’t manage to sync any changes yet.