Unhandled internal error when trying to produce a JS version of my PsychoPy Python code

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

OS (e.g. Win10): WIN11
PsychoPy version (e.g. 2024.2.4 Py 3.8): 2025.2.4beta
Standard Standalone Installation? (y/n) Y
Do you want it to also run online? (y/n) Y
What are you trying to achieve?: Convert a successful Psychopy scriptinto JS

What did you try to make it work?: After the failure I gave up

Link to the most relevant existing thread you have found:

What specifically went wrong when you tried that?:
Include pasted full error message if possible. “That didn’t work” is not enough information.

When ignore the error and try to run the Java Script anyhow, I get an error because it has an extra curled bracket ‘}’. I cannot see where that came from.

Traceback (most recent call last):
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\projects\pavlovia.py”, line 705, in getitem
value = dict.getitem(self, key)
KeyError: ‘path_with_namespace’

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\app\builder\builder.py”, line 936, in fileExport
self.app.showCoder(fileList=[exportPath])
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\app_psychopyApp.py”, line 845, in showCoder
self.coder = coder.CoderFrame(None, -1,
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\app\coder\coder.py”, line 1243, in init
self.setCurrentDoc(filename, keepHidden=True)
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\app\coder\coder.py”, line 2348, in setCurrentDoc
self.ribbon.buttons[‘pavproject’].updateInfo()
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\app\ribbon.py”, line 960, in updateInfo
if project is None or project[‘path_with_namespace’] is None:
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\projects\pavlovia.py”, line 708, in getitem
if self.project is None:
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\projects\pavlovia.py”, line 797, in project
self._project = self.session.gitlab.projects.get(self.id)
File “C:\Program Files\PsychoPy\lib\site-packages\gitlab\exceptions.py”, line 346, in wrapped_f
return f(*args, **kwargs)
File “C:\Program Files\PsychoPy\lib\site-packages\gitlab\mixins.py”, line 99, in get
server_data = self.gitlab.http_get(path, **kwargs)
File “C:\Program Files\PsychoPy\lib\site-packages\gitlab\client.py”, line 804, in http_get
result = self.http_request(
File “C:\Program Files\PsychoPy\lib\site-packages\gitlab\client.py”, line 764, in http_request
raise gitlab.exceptions.GitlabAuthenticationError(
gitlab.exceptions.GitlabAuthenticationError: 401: invalid_token

Sounds similar to this other forum item involving sound components and curly brackets.

That one doesn’t include gitlab.exceptions.GitlabAuthenticationError: 401: invalid_token

This one does:

@wakecarter I don’t know if it’s related to the original post but in my machine (W11) with 2025.2.3 installed, PsychoPy keeps giving this error at intervals when I try to sync, about every 2 hours. I need to restart PsychoPy and login again via the interface. I have deleted the users.json file a few times already.

I think 2025.2.4 will sort that.

1 Like

2 hours is exactly right; we recently updated the Pavlovia servers to a newer version of GitLab for the data security improvements that come with it, but this new version requires that login tokens expire after 2 hours.

2025.2.4 includes code to automatically “refresh” your login (i.e. if it’s expired, it requests a new code without you needing to login again), so going forward this shouldn’t be a problem, but unfortunately on existing installs you’ll have to log back in every 2 hours. It’s annoying but necessary, unfortunately.