# Unhandled error/ no new js file being created

**URL:** <https://discourse.psychopy.org/t/unhandled-error-no-new-js-file-being-created/21882>\
**Category:** Online experiments\
**Created:** [March 31, 2021, 4:59am UTC](https://discourse.psychopy.org/t/unhandled-error-no-new-js-file-being-created/21882 "2021-03-31T04:59:42Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kylie](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/kylie/32/13333_2.png) [@Kylie](https://discourse.psychopy.org/u/Kylie)\
**Post date:** [March 31, 2021, 4:59am UTC](https://discourse.psychopy.org/t/unhandled-error-no-new-js-file-being-created/21882/1 "2021-03-31T04:59:42Z")

</div>

URL of experiment: [https://gitlab.pavlovia.org/knfernandez/two-decision-pathways-online-v2](https://gitlab.pavlovia.org/knfernandez/two-decision-pathways-online-v2)

The paradigm I seem to have an issue was working in pilot mode here, but then would not update: [Pavlovia](https://pavlovia.org/knfernandez/risky-gambles)

Description of the problem: For some reason, there is one paradigm that when I add it to my experiments, at some point I am unable to update the experiment on Pavlovia. It appears that this paradigm somehow stops PsychoPy from generating a new JS file, which would explain why it does not update on Pavlovia. I have tried the usual methods of clearing my cache, checking for any empty text components, syntax errors, etc. I have even tried creating the experiment from scratch multiple times and either I can get the experiment to sync once and then it stops, or it completely fails to create a JS file and therefore cannot be run on Pavlovia. I am using PsychoPy version 2020.2.10 since I’ve been working on this for several months and was worried about compatibility issues if I changed. Currently, I am not receiving any errors but the JS file is still not updating.

At this point, I am really hoping it’s something silly I’ve missed or didn’t realize would be an issue. This is the last paradigm I need to get working so I can collect data.

---

<div class="post-metadata">

**Author:** ![thomas\_pronk](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/thomas_pronk/32/9531_2.png) [@thomas\_pronk](https://discourse.psychopy.org/u/thomas_pronk)\
**Post date:** [March 31, 2021, 9:59am UTC](https://discourse.psychopy.org/t/unhandled-error-no-new-js-file-being-created/21882/2 "2021-03-31T09:59:44Z")

</div>

Could you share your gitlab repo with me? (tpronk) I’ll need to be a developer or maintainer

---

<div class="post-metadata">

**Author:** ![Kylie](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/kylie/32/13333_2.png) [@Kylie](https://discourse.psychopy.org/u/Kylie)\
**Post date:** [March 31, 2021, 12:40pm UTC](https://discourse.psychopy.org/t/unhandled-error-no-new-js-file-being-created/21882/3 "2021-03-31T12:40:24Z")

</div>

Yes, done. I need the “two decision pathways online v2” one to work, but I you have access to the one titled “Risky Gambles” in case that is helpful at all.

---

<div class="post-metadata">

**Author:** ![Kylie](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/kylie/32/13333_2.png) [@Kylie](https://discourse.psychopy.org/u/Kylie)\
**Post date:** [March 31, 2021, 3:57pm UTC](https://discourse.psychopy.org/t/unhandled-error-no-new-js-file-being-created/21882/4 "2021-03-31T15:57:52Z")

</div>

Is it possible there’s something wrong with my Pavlovia account? I am now working on a completely unrelated experiment, and everything was going fine. But, suddenly, I am having the same problem where the JS files are no longer being updated. PsychoPy claims everything synced successfully, but there is an alert that says “Alert 4210:JavaScript Syntax Error in ‘Begin JS Experiment’ tab. See ‘Line 1: Unexpected token’ in the ‘Begin JS Experiment’ tab.  
For further info see [4210: Probable syntax error detected in your JavaScript code — PsychoPy v2021.1](https://psychopy.org/alerts/4210.html)”

I deleted some code that was referring to something I removed then tried to sync. I realized that this did not actually update the JS file, so I added the next routine I need since sometimes it seems a code edit isn’t enough to register a change that needs to be synced. I also cleared my cache. However, this also did not update the JS file.

---

<div class="post-metadata">

**Author:** ![thomas\_pronk](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/thomas_pronk/32/9531_2.png) [@thomas\_pronk](https://discourse.psychopy.org/u/thomas_pronk)\
**Post date:** [March 31, 2021, 4:13pm UTC](https://discourse.psychopy.org/t/unhandled-error-no-new-js-file-being-created/21882/5 "2021-03-31T16:13:56Z")

</div>

I don’t think there is an issue with your Pavlovia account.

I just examined the first issue you reported using a developer version of PsychoPy 2021.1.3 (that’s code I pull in from GitHub, not packaged as something you can download from [psychopy.org](http://psychopy.org) yet). This way I could dive into PsychoPy itself to figure out what’s happening. I noticed an interaction between a bug in PsychoPy and a setting in your experiment; somewhere there was a value “2.0” that confused PsychoPy.

I’ve got a fix for the PsychoPy bug, but getting that fix to you might requires us to jump through a couple of hoops. I’ll ask around to see what is the best route to take. Note that the easiest route would probably take a bit of time to wait for the 2021.1.3 release, and would require you to upgrade. If you happen to know where that “2.0” might be coming from, we might be able to think of a workaround.

---

<div class="post-metadata">

**Author:** ![Kylie](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/kylie/32/13333_2.png) [@Kylie](https://discourse.psychopy.org/u/Kylie)\
**Post date:** [March 31, 2021, 4:36pm UTC](https://discourse.psychopy.org/t/unhandled-error-no-new-js-file-being-created/21882/6 "2021-03-31T16:36:57Z")

</div>

OK, that is good to know. Is it possibly a problem with the version of PsychoPy I am using, since there are updates I am missing out on from 2021?

I am using “2.0” intentionally while randomly setting an ITI, and also while adjusting an image. I think I was having issues with the results evaluating correctly when I initially added them, but this may now be resolved from updates where I could switch them out to “2” instead? PsychoPy also seems to have added some “2.0” of its own, but here are the ones I added.

```auto
    # ------Prepare to start Routine "gamITI"-------
    continueRoutine = True
    # update component parameters for each repeat
    setGambITI = (Math.random() * 2.0) + 1.0

```

```auto
strTimW = ((2.0 - t)/2.0)*1.8

```

Can you explain why “2.0” would cause an issue? I have other decimal numbers and want to make sure those won’t also result in issues.

---

<div class="post-metadata">

**Author:** ![thomas\_pronk](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/thomas_pronk/32/9531_2.png) [@thomas\_pronk](https://discourse.psychopy.org/u/thomas_pronk)\
**Post date:** [March 31, 2021, 4:52pm UTC](https://discourse.psychopy.org/t/unhandled-error-no-new-js-file-being-created/21882/7 "2021-03-31T16:52:27Z")

</div>

To be honest, I’m not sure why this one went wrong and others did not. I can tell you what’s up, for what it’s worth. The function below checks for parameters whether they refer to directories and does some processing. It only works with strings, but the 2.0 got received as number instead. Converting it from a number to a string before converting solves it.

It can be a challenge to trace this back to its source, though I can say it’s probably not in the code you posted, but somewhere in a component property.

> <https://github.com/psychopy/psychopy/blob/336cdd7dedb387566bb7fb6910bfd73f27c8265f/psychopy/experiment/_experiment.py#L791>

My fix

```python
        def getPaths(filePath):
            """Helper to return absolute and relative paths (or None)

            :param filePath: str to a potential file path (rel or abs)
            :return: dict of 'asb' and 'rel' paths or None
            """
            thisFile = {}
            # NB: Pathlib might be neater here but need to be careful
            # e.g. on mac:
            # Path('C:/test/test.xlsx').is_absolute() returns False
            # Path('/folder/file.xlsx').relative_to('/Applications') gives error
            # but os.path.relpath('/folder/file.xlsx', '/Applications') correctly uses ../
            filePathStr = str(filePath);
            if len(filePathStr) > 2 and (filePathStr[0] == "/" or filePathStr[1] == ":")\
                    and os.path.isfile(filePathStr):
                thisFile['abs'] = filePathStr
                thisFile['rel'] = os.path.relpath(filePathStr, srcRoot)
                return thisFile
            else:
                thisFile['rel'] = filePathStr
                thisFile['abs'] = os.path.normpath(join(srcRoot, filePathStr))
                if os.path.isfile(thisFile['abs']):
                    return thisFile

```

---

<div class="post-metadata">

**Author:** ![Kylie](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/kylie/32/13333_2.png) [@Kylie](https://discourse.psychopy.org/u/Kylie)\
**Post date:** [March 31, 2021, 5:47pm UTC](https://discourse.psychopy.org/t/unhandled-error-no-new-js-file-being-created/21882/8 "2021-03-31T17:47:46Z")

</div>

I am not quite sure what/where to implement this fix, sorry.

Since you mentioned the issue is probably in a component, would that possibly look something like this?

```auto
    win=win, name='subPerf2',
    vertices=[[-(0.03, 0.03)[0]/2.0,-(0.03, 0.03)[1]/2.0], [+(0.03, 0.03)[0]/2.0,-(0.03, 0.03)[1]/2.0], [0,(0.03, 0.03)[1]/2.0]],
    ori=0, pos=[0,0],
    lineWidth=1, lineColor=[1,1,1], lineColorSpace='rgb',
    fillColor=[1,1,1], fillColorSpace='rgb',
    opacity=1.0, depth=-2.0, interpolate=True)

```

This is a polygon (triangle) that updates coordinates with participant performance/accuracy.

If this is possibly the problem, would disabling during testing potentially allow the code to sync from PsychoPy?

---

<div class="post-metadata">

**Author:** ![thomas\_pronk](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/thomas_pronk/32/9531_2.png) [@thomas\_pronk](https://discourse.psychopy.org/u/thomas_pronk)\
**Post date:** [March 31, 2021, 6:00pm UTC](https://discourse.psychopy.org/t/unhandled-error-no-new-js-file-being-created/21882/9 "2021-03-31T18:00:37Z")

</div>

Yes, if that’s the problem, then your experiment should generate JS (or at least give a different problem) when you disable that component. For an actual fix, it depends mostly on whether you’d be willing to upgrade, and/or wait for the next release, and/or got the ability to install a developer version of PsychoPy. How do you feel about that?

---

<div class="post-metadata">

**Author:** ![Kylie](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/kylie/32/13333_2.png) [@Kylie](https://discourse.psychopy.org/u/Kylie)\
**Post date:** [March 31, 2021, 6:12pm UTC](https://discourse.psychopy.org/t/unhandled-error-no-new-js-file-being-created/21882/10 "2021-03-31T18:12:44Z")

</div>

I just tested disabling that component (there was another one similar to it that I disabled as well) and syncing with no change to the JS file updating.

I need the experiments to work, so I am willing to upgrade and/or try the developer version. Would I need to completely rebuild my experiments from scratch in 2021 for them to work? Or is it possible that if I upgrade I can edit components so everything works? I’m not 100% sure what the developer version would entail, but I am willing to try!

I would prefer not waiting too much longer as I need to start data collection ASAP and cannot really afford to wait.

---

<div class="post-metadata">

**Author:** ![thomas\_pronk](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/thomas_pronk/32/9531_2.png) [@thomas\_pronk](https://discourse.psychopy.org/u/thomas_pronk)\
**Post date:** [March 31, 2021, 7:24pm UTC](https://discourse.psychopy.org/t/unhandled-error-no-new-js-file-being-created/21882/11 "2021-03-31T19:24:22Z")

</div>

All right, let’s try this out then! You’ll be able to open your experiment in 2021 so no worries there.

- The steps for installing a developer version are described here: [https://www.psychopy.org/download.html#developers-install](https://www.psychopy.org/download.html#developers-install)
- Where it says “Next, follow instructions [here](https://www.psychopy.org/developers/repository.html#usingrepos) to fork and fetch the latest version of the PsychoPy repository”, use my fork instead. That fork is over here: [https://github.com/tpronk/psychopy](https://github.com/tpronk/psychopy)

---

<div class="post-metadata">

**Author:** ![Kylie](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/kylie/32/13333_2.png) [@Kylie](https://discourse.psychopy.org/u/Kylie)\
**Post date:** [April 1, 2021, 4:13am UTC](https://discourse.psychopy.org/t/unhandled-error-no-new-js-file-being-created/21882/12 "2021-04-01T04:13:09Z")

</div>

I believe everything should be setup in terms of git, now.

I assume I also need to install 2021 PsychoPy, but is there another step or anything I should know first?

---

<div class="post-metadata">

**Author:** ![thomas\_pronk](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/thomas_pronk/32/9531_2.png) [@thomas\_pronk](https://discourse.psychopy.org/u/thomas_pronk)\
**Post date:** [April 1, 2021, 11:23am UTC](https://discourse.psychopy.org/t/unhandled-error-no-new-js-file-being-created/21882/13 "2021-04-01T11:23:59Z")

</div>

This procedure does not involve downloading the installer from [psychopy.org](http://psychopy.org), instead we’re installing a version of PsychoPy from my GitHub. Just follow the steps I listed in my previous post.

---

<div class="post-metadata">

**Author:** ![Kylie](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/kylie/32/13333_2.png) [@Kylie](https://discourse.psychopy.org/u/Kylie)\
**Post date:** [April 1, 2021, 4:52pm UTC](https://discourse.psychopy.org/t/unhandled-error-no-new-js-file-being-created/21882/14 "2021-04-01T16:52:04Z")

</div>

Sorry, I am new to using Git this way and developer tools. Since everything is downloaded/installed, how exactly do I open my experiment in this new version of PsychoPy? I tried looking through discourse and the related websites, but did not find the answer.

---

<div class="post-metadata">

**Author:** ![thomas\_pronk](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/thomas_pronk/32/9531_2.png) [@thomas\_pronk](https://discourse.psychopy.org/u/thomas_pronk)\
**Post date:** [April 1, 2021, 10:07pm UTC](https://discourse.psychopy.org/t/unhandled-error-no-new-js-file-being-created/21882/15 "2021-04-01T22:07:39Z")

</div>

You can launch the builder using the CLI command listed here: [Installation — PsychoPy v2021.1](https://www.psychopy.org/download.html#developers-install)  
`python C:\PATH_TO_CLONED_PSYCHOPY_REPO\psychopy\app\psychopyApp`

If everything is indeed correctly set up, this should start up my fork, with which I managed to succesfully generate JS from your experiment

---

<div class="post-metadata">

**Author:** ![Kylie](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/kylie/32/13333_2.png) [@Kylie](https://discourse.psychopy.org/u/Kylie)\
**Post date:** [April 6, 2021, 4:27am UTC](https://discourse.psychopy.org/t/unhandled-error-no-new-js-file-being-created/21882/16 "2021-04-06T04:27:06Z")

</div>

Thank you for all your help. I haven’t quite got the developer version working yet, but I was able to try out at least using 2021 which created a JS file. However, upon running that JS file, I noticed that the task that seems to be causing the error was skipped entirely. I was wondering if I could see the JS file your version created to see if the same thing happened?

---

<div class="post-metadata">

**Author:** ![Kylie](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/kylie/32/13333_2.png) [@Kylie](https://discourse.psychopy.org/u/Kylie)\
**Post date:** [April 6, 2021, 6:05pm UTC](https://discourse.psychopy.org/t/unhandled-error-no-new-js-file-being-created/21882/17 "2021-04-06T18:05:42Z")

</div>

I have also tried removing any code for the task that seems to cause the PsychoPy to Pavlovia issue, and stick with basic components like text. However, this also does not resolve the issue when running 2020. For some reason, there is something blocking this particular task being updated in the JS file.

I will try to upload a copy to Pavlovia with only the components and see if this at least allows the placeholder component version of the task to appear, but I am not sure what is causing the issue or how to potentially override it. I am also working on getting the dev version, but on a computer that does not already have multiple versions of python or git used for other software.

---

<div class="post-metadata">

**Author:** ![thomas\_pronk](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/thomas_pronk/32/9531_2.png) [@thomas\_pronk](https://discourse.psychopy.org/u/thomas_pronk)\
**Post date:** [April 7, 2021, 4:59pm UTC](https://discourse.psychopy.org/t/unhandled-error-no-new-js-file-being-created/21882/18 "2021-04-07T16:59:15Z")

</div>

I shared my version of the gitlab repo with you. Sad to hear your edits didn’t work out. I generated the JS in my version of your experiment with that fork I made of PsychoPy that includes the bug-fix. We’re planning a new release somewhere in the next 1/2 weeks which will include this fix btw.

---

<div class="post-metadata">

**Author:** ![Kylie](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/kylie/32/13333_2.png) [@Kylie](https://discourse.psychopy.org/u/Kylie)\
**Post date:** [April 8, 2021, 5:41pm UTC](https://discourse.psychopy.org/t/unhandled-error-no-new-js-file-being-created/21882/19 "2021-04-08T17:41:20Z")

</div>

Thank you for sharing your version with me. Unfortunately, I tried forking and syncing that version and received the following error while trying to sync it locally from my account:

Traceback (most recent call last):  
File “C:\Program Files\PsychoPy3\lib\site-packages\urllib3\connectionpool.py”, line 384, in \_make\_request  
six.raise\_from(e, None)  
File “”, line 2, in raise\_from  
File “C:\Program Files\PsychoPy3\lib\site-packages\urllib3\connectionpool.py”, line 380, in \_make\_request  
httplib\_response = conn.getresponse()  
File “C:\Program Files\PsychoPy3\lib\http\client.py”, line 1331, in getresponse  
response.begin()  
File “C:\Program Files\PsychoPy3\lib\http\client.py”, line 297, in begin  
version, status, reason = self.\_read\_status()  
File “C:\Program Files\PsychoPy3\lib\http\client.py”, line 258, in \_read\_status  
line = str(self.fp.readline(\_MAXLINE + 1), “iso-8859-1”)  
File “C:\Program Files\PsychoPy3\lib\socket.py”, line 586, in readinto  
return self.\_sock.recv\_into(b)  
File “C:\Program Files\PsychoPy3\lib\site-packages\urllib3\contrib\pyopenssl.py”, line 298, in recv\_into  
raise timeout(‘The read operation timed out’)  
socket.timeout: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):  
File “C:\Program Files\PsychoPy3\lib\site-packages\requests\adapters.py”, line 449, in send  
timeout=timeout  
File “C:\Program Files\PsychoPy3\lib\site-packages\urllib3\connectionpool.py”, line 638, in urlopen  
\_stacktrace=sys.exc\_info()[2])  
File “C:\Program Files\PsychoPy3\lib\site-packages\urllib3\util\retry.py”, line 367, in increment  
raise six.reraise(type(error), error, \_stacktrace)  
File “C:\Program Files\PsychoPy3\lib\site-packages\urllib3\packages\six.py”, line 686, in reraise  
raise value  
File “C:\Program Files\PsychoPy3\lib\site-packages\urllib3\connectionpool.py”, line 600, in urlopen  
chunked=chunked)  
File “C:\Program Files\PsychoPy3\lib\site-packages\urllib3\connectionpool.py”, line 386, in \_make\_request  
self.\_raise\_timeout(err=e, url=url, timeout\_value=read\_timeout)  
File “C:\Program Files\PsychoPy3\lib\site-packages\urllib3\connectionpool.py”, line 306, in \_raise\_timeout  
raise ReadTimeoutError(self, url, “Read timed out. (read timeout=%s)” % timeout\_value)  
urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host=‘[gitlab.pavlovia.org](http://gitlab.pavlovia.org)’, port=443): Read timed out. (read timeout=2)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):  
File “C:\Program Files\PsychoPy3\lib\site-packages\psychopy\app\pavlovia\_ui\project.py”, line 364, in onSyncButton  
self.project.sync(infoStream=self.syncPanel.infoStream)  
File “C:\Program Files\PsychoPy3\lib\site-packages\psychopy\projects\pavlovia.py”, line 640, in sync  
self.repo = self.getRepo(forceRefresh=True, infoStream=infoStream)  
File “C:\Program Files\PsychoPy3\lib\site-packages\psychopy\projects\pavlovia.py”, line 763, in getRepo  
self.pavlovia = getCurrentSession().gitlab.projects.get(self.id)  
File “C:\Program Files\PsychoPy3\lib\site-packages\gitlab\exceptions.py”, line 242, in wrapped\_f  
return f(\*args, \*\*kwargs)  
File “C:\Program Files\PsychoPy3\lib\site-packages\gitlab\mixins.py”, line 49, in get  
server\_data = self.gitlab.http\_get(path, \*\*kwargs)  
File “C:\Program Files\PsychoPy3\lib\site-packages\gitlab\__init_\_.py”, line 517, in http\_get  
streamed=streamed, \*\*kwargs)  
File “C:\Program Files\PsychoPy3\lib\site-packages\gitlab\__init_\_.py”, line 472, in http\_request  
result = self.session.send(prepped, timeout=timeout, \*\*settings)  
File “C:\Program Files\PsychoPy3\lib\site-packages\requests\sessions.py”, line 646, in send  
r = adapter.send(request, \*\*kwargs)  
File “C:\Program Files\PsychoPy3\lib\site-packages\requests\adapters.py”, line 529, in send  
raise ReadTimeout(e, request=request)  
requests.exceptions.ReadTimeout: HTTPSConnectionPool(host=‘[gitlab.pavlovia.org](http://gitlab.pavlovia.org)’, port=443): Read timed out. (read timeout=2)

I had used the search function to search through my account (so it was logged in on Pavlovia). The project appears in Gitlab, but not in my Pavlovia experiment dashboard.

At this point I am at a loss of what to do and was hoping some sort of virtual meeting would be possible to figure out what is going on and/or what my best course of action is. I have two experiments that I need to run and I can no longer make even small edits (like the number of repetitions for a loop) to my experiments. Please let me know!

---

<div class="post-metadata">

**Author:** ![thomas\_pronk](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/thomas_pronk/32/9531_2.png) [@thomas\_pronk](https://discourse.psychopy.org/u/thomas_pronk)\
**Post date:** [April 9, 2021, 9:31am UTC](https://discourse.psychopy.org/t/unhandled-error-no-new-js-file-being-created/21882/20 "2021-04-09T09:31:57Z")

</div>

For this one I’ve got a quick fix: logout and login again (inside of Builder). Then the issue is likely resolved

[Next page](https://discourse.psychopy.org/t/unhandled-error-no-new-js-file-being-created/21882.md?page=2)
