Problems with Pavlovia synchronization

Win 10, PsychoPy Builder 2025.1.1, Standalone.
I am trying to push an experiment made in Builder to Pavlovia for the first time. I read different threads, instructions but I guess I am doing sth wrong. I did not plan to run the experiment online (PI asked me to transform it into a Pavlovia exp, “quickly”), therefore it has a lot of code components and it is generally not ideal for online testing (uses sounds, mouse drag and drop, RT measurement etc.).
I rewrote all the custom code components, removed certain things (like import libraries etc.), added the resources in the Experiment settings → Online tab.

Then I signed in my Pavlovia account, exported the HTML and I tried to do the synch in the Pavlovia tab. I created a project in the pop up window, added the project folder from my PC in which I have everything (the compliled and eht builder script, index html etc. + hundreds of visual and audio stims and csv lists in subfolders). when I hit OK, I receive this message:

Traceback (most recent call last):
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\app\pavlovia_ui\menu.py”, line 116, in onSync
syncProject(parent=self.parent, project=self.parent.project)
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\app\pavlovia_ui\project.py”, line 854, in syncProject
project.sync()
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\projects\pavlovia.py”, line 916, in sync
self.firstPush(infoStream=infoStream)
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\projects\pavlovia.py”, line 1155, in firstPush
info = self.commit(
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\projects\pavlovia.py”, line 1321, in commit
info = self.repo.git.commit(‘-m’, message)
File “C:\Program Files\PsychoPy\lib\site-packages\git\cmd.py”, line 986, in
return lambda *args, **kwargs: self._call_process(name, *args, **kwargs)
File “C:\Program Files\PsychoPy\lib\site-packages\git\cmd.py”, line 1599, in _call_process
return self.execute(call, **exec_kwargs)
File “C:\Program Files\PsychoPy\lib\site-packages\git\cmd.py”, line 1389, in execute
raise GitCommandError(redacted_command, status, stderr_value, stdout_value)
git.exc.GitCommandError: Cmd(‘C:\Program Files\PsychoPy\MinGit\cmd\git.exe’) failed due to: exit code(1)
cmdline: C:\Program Files\PsychoPy\MinGit\cmd\git.exe commit -m Push initial project files
stdout: ‘On branch master
nothing to commit, working tree clean’

I also tried to skip the export HTML part. To my surprise then the synchronization works, the project appears on Pavlovia (I see it and all the resources whwn i click on View code) but then the platform is set to UNKNOWN and I get a 403 forbidden error when I try to pilot/run the expeirment. So I guess something is not okay.
What shall I do, to be able to test the experiment online? (and figure out what else needs to be changed in the script)?
I would really appreciate any help.

Hello @danna

‘UNKOWN’ indicates that Pavlovia cannot determine the PsychoJS version. This is most likely because your PsychoJS code did not compile without errors.

You can test the PsychoJS version of your experiment by running it locally in a browser. Once it is running locally, it will also run online.

Best wishes Jens

Hi, Thanks for the response @JensBoelte. It says “[Init] Please wait a moment..”. And I see rather unspecific error messages: “The component or routine ‘VariableComponent’ is only implemented locally, so will do nothing when running online. For further info see 4340: Component or routine not implemented in JavaScript — PsychoPy v2025.2.4” So I don’t know what to correct…
Shall I maybe define each and every loop and component (e.e. main_mouse, welcome_text, proceed_button…etc.etc.) within the routines at the beginning of the experiment with “let”? I read in a thread here that one shall not do this if the experiment was created in Builder, but I talked to someone who did it and her experiment ran afterwards.

Hello @danna

In fact, the Builder usually does a good job of automatically translating PsychoPy to PsychoJS. Therefore, it is not advisable to manually alter the PsychoJS code. The auto-translate function will overwrite any manual changes you make unless it is turned off.

Take a look here to see how to debug your PsychoJS code.

You can also find information about shortcomings in the auto-translate here.

Best wishes Jens

Hi, Thanks for the reply. How do I manually turn off the auto-translate in Builder? for the custom code components changed Auto-JS to JS everywhere. I read it specifically in this forum that custom code components should be manually altered, I should use sth else instead of pandas for reading in files, I should use a different list comprehension, read in sounds in a different way etc.etc. to make a builder script online compatible because the auto translation is not good for these (works for the main components, and simple experiments). But maybe I misunderstood some things. (FYI: Thomas’s demos for debugging do not run, at least for me.)

Hello @danna

You can not use Python-libraries for online experiments. Take a look at the crib sheets by wakecarter.

Best wishes Jens

Thanks. I made most of my manual changes based on those sheets / related threads. I know I cannot use Python libraries (I mentioned this in my previous response), the current code does not use any of these. Unfortunately, I am still stuck and don’t know how I could figure out what is wrong and what changes I should implement to make the experiment work. (Probably more than one.)

Hello @danna

What is the error message when you try to run the experiment locally in a browser?

I assume that the PsychoPy-Version runs without problems?

Best wishes Jens

Hi, It runs. I tried to relocate the whole folder as there were special (russian) characters in the previous path, delete the experiment form Pavlovia, then push it again, creating a new project, but it did not help.
When I tried to run the exp online and open the console to see what’s wrong, I see this:
DT_RELIR_B1B2_202602.js:1 Failed to load resource: the server responded with a status of 404 (File not found)Understand this error
:12002/favicon.ico:1 Failed to load resource: the server responded with a status of 404 (File not found). I see the code there on Pavlovia and all the resources. In the
Now for the third or fourth try, the page is not working (sth like the localhost did not send data…). So it is even worse.

Is this the name of your experiment? With all the copies you are making, the index.html file might be looking for the wrong JS file.

Hi, renaming and resynch-ing did not work. The page is not loaading “localhost did not send data”. I deleted and recreated the project a few times today, so this might have caused problems (seemingly the project disappeared but when trying to view the code of the next attempt, I saw that the last update of many elements is yesterday etc., so I guess sth went wrong). I am terribly sorry, I am not great in Python coding, have little JS experience and and even less knowledge about how github & Pavlovia works. I just can’t resolve this issue myself. Btw: I nte Runner I see tons of these messages (when trying to pilot the JS script online): Alert 4340:
The component or routine ‘VariableComponent’ is only implemented locally, so will do nothing when running online.
For further info see 4340: Component or routine not implemented in JavaScript — PsychoPy v2025.2.4
And two of these:
Alert 4210:
JavaScript Syntax Error in ‘Begin JS Routine’ tab. See ‘Line 2: Unexpected token ILLEGAL’ in the ‘Begin JS Routine’ tab.
For further info see 4210: Probable syntax error detected in your JavaScript code — PsychoPy v2025.2.4

Are you using a Variable component? If so, you will need to switch to a code component for it to run online.

Do any of your code components set to Auto show JavaScript syntax errors?

Does the experiment run as intended locally?

Do you import any Python libraries?

Hi, in the python version I do import libraries (pd, sound) but I rewrote the PsychoJS part in a way that I do not need them (code type set to Both). I started with the Auto-JS version, and only changed things that are supposed to be changed in PsychoJS, according to threads I read here… The experiment ran locally as intended however I get now the error message below when starting PsychoPy (then it runs). I use headphones, maybe that also matters (?). I do have Variable components in some routines that I did not transform manually i in the JS part. Do I have to define them simply by “let Var ===” ?

Here is the error message that pops up when I start PsychoPy now. (The original version of the exp - in a different folder - where I did not switch to “Both” and changed the custom code component parts in JS runs without any errors.)

Error message when starting the psychopy script:
Traceback (most recent call last):
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\app_psychopyApp.py”, line 1215, in onIdle
idle.doIdleTasks(app=self) # run once
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\app\idle.py”, line 133, in doIdleTasks
_doTask(taskName, app)
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\app\idle.py”, line 170, in _doTask
currentTask’func’
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\app\pavlovia_ui\menu.py”, line 103, in setUser
pavlovia.login(token)
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\projects\pavlovia.py”, line 153, in login
currentSession.setToken(token)
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\projects\pavlovia.py”, line 450, in setToken
self.startSession(token)
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\projects\pavlovia.py”, line 483, in startSession
self.gitlab.auth()
File “C:\Program Files\PsychoPy\lib\site-packages\gitlab\client.py”, line 400, in auth
self.user = self._objects.CurrentUserManager(self).get()
File “C:\Program Files\PsychoPy\lib\site-packages\gitlab\v4\objects\users.py”, line 172, in get
return cast(CurrentUser, super().get(**kwargs))
File “C:\Program Files\PsychoPy\lib\site-packages\gitlab\exceptions.py”, line 344, in wrapped_f
return f(*args, **kwargs)
File “C:\Program Files\PsychoPy\lib\site-packages\gitlab\mixins.py”, line 157, in get
server_data = self.gitlab.http_get(self.path, **kwargs)
File “C:\Program Files\PsychoPy\lib\site-packages\gitlab\client.py”, line 813, in http_get
result = self.http_request(
File “C:\Program Files\PsychoPy\lib\site-packages\gitlab\client.py”, line 773, in http_request
raise gitlab.exceptions.GitlabAuthenticationError(
gitlab.exceptions.GitlabAuthenticationError: 401: invalid_token

Hello @danna

Besides the VariableComponent which does not work online, try to fix above mentioned error. Follow the advice given by @wakecarter .

Best wishes Jens

Hi, Thanks. Do you have any idea what may cause the error message when I start PsychoPy? Now it shows up for the original version as well (different folder), that was never fetched…

Since you are using 2025.1.1 you will frequently need to log into Pavlovia in PsychoPy. Try logging out and logging in again from Builder.

No.

Thanks. Sorry for this question, I just want to make sure that I understand what you wrote correctly. Am I required to do the same, if I created variable components to get them saved in the datafile. so let’s say I have blocknumber, chunknumber etc. initialized and set in a custom code component and a BlockNum, ChunkNum etc. variable component added to a routine (which is set to blocknumber, chunknumber etc.)?

I don’t use variable components, but if you want to save the value of blocknumber to your datafile then the Python code is:

thisExp.addData('BlockNum',blocknumber)

This will auto-translate to JS correctly.

Hi,
Thank you! I will get back sometime later to tell whether the experiment runs with all the suggested changes. In any case, I learnt a lot from the replies, so thanks again.