# Not able to run experiment online

**URL:** <https://discourse.psychopy.org/t/not-able-to-run-experiment-online/16872>\
**Category:** Online experiments\
**Created:** [September 29, 2020, 4:58am UTC](https://discourse.psychopy.org/t/not-able-to-run-experiment-online/16872 "2020-09-29T04:58:02Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![2clarkmoore2](https://avatars.discourse-cdn.com/v4/letter/2/7ab992/32.png) [@2clarkmoore2](https://discourse.psychopy.org/u/2clarkmoore2)\
**Post date:** [September 29, 2020, 4:58am UTC](https://discourse.psychopy.org/t/not-able-to-run-experiment-online/16872/1 "2020-09-29T04:58:02Z")

</div>

Hello,

I am testing to see if I can get my code to pilot and when I click run online in builder mode (or pilot on pavlovia) I get an error message in my web browser that says

# 403 Forbidden

nginx

What do I need to do to get this to work?

Thank you!  
Clark

---

<div class="post-metadata">

**Author:** ![sotiri](https://avatars.discourse-cdn.com/v4/letter/s/59ef9b/32.png) [@sotiri](https://discourse.psychopy.org/u/sotiri)\
**Post date:** [September 29, 2020, 7:07am UTC](https://discourse.psychopy.org/t/not-able-to-run-experiment-online/16872/2 "2020-09-29T07:07:10Z")

</div>

Hey @2clarkmoore2, could you send me a link to your study so that I can investigate a bit further? Here to help, thanks, s.

---

<div class="post-metadata">

**Author:** ![2clarkmoore2](https://avatars.discourse-cdn.com/v4/letter/2/7ab992/32.png) [@2clarkmoore2](https://discourse.psychopy.org/u/2clarkmoore2)\
**Post date:** [September 29, 2020, 8:10am UTC](https://discourse.psychopy.org/t/not-able-to-run-experiment-online/16872/3 "2020-09-29T08:10:01Z")

</div>

[https://run.pavlovia.org/2clarkmoore2/hl\_ensemble\_pilot/](https://run.pavlovia.org/2clarkmoore2/hl_ensemble_pilot/)

also here is the gitlab:

> **[Sign in](https://gitlab.pavlovia.org/users/sign_in)**
>
> Sign In/Register

Thank you

---

<div class="post-metadata">

**Author:** ![sotiri](https://avatars.discourse-cdn.com/v4/letter/s/59ef9b/32.png) [@sotiri](https://discourse.psychopy.org/u/sotiri)\
**Post date:** [September 29, 2020, 9:37am UTC](https://discourse.psychopy.org/t/not-able-to-run-experiment-online/16872/4 "2020-09-29T09:37:06Z")

</div>

No worries, your study must be set to private and I lack sufficient rights to access the repo, would it be possible to upload the .psyexp here instead? Thanks, s.

---

<div class="post-metadata">

**Author:** ![2clarkmoore2](https://avatars.discourse-cdn.com/v4/letter/2/7ab992/32.png) [@2clarkmoore2](https://discourse.psychopy.org/u/2clarkmoore2)\
**Post date:** [September 30, 2020, 12:23am UTC](https://discourse.psychopy.org/t/not-able-to-run-experiment-online/16872/5 "2020-09-30T00:23:15Z")

</div>

[HL\_ensemble\_prestim.psyexp](https://discourse.psychopy.org/uploads/short-url/bVngWtvs8LATaGqIcBtupcNQs0U.psyexp) (2.5 KB)

---

<div class="post-metadata">

**Author:** ![2clarkmoore2](https://avatars.discourse-cdn.com/v4/letter/2/7ab992/32.png) [@2clarkmoore2](https://discourse.psychopy.org/u/2clarkmoore2)\
**Post date:** [September 30, 2020, 5:39am UTC](https://discourse.psychopy.org/t/not-able-to-run-experiment-online/16872/6 "2020-09-30T05:39:51Z")

</div>

I feel like I may be missing some step in preparing the code to link into an online mode.

---

<div class="post-metadata">

**Author:** ![sotiri](https://avatars.discourse-cdn.com/v4/letter/s/59ef9b/32.png) [@sotiri](https://discourse.psychopy.org/u/sotiri)\
**Post date:** [September 30, 2020, 9:15am UTC](https://discourse.psychopy.org/t/not-able-to-run-experiment-online/16872/7 "2020-09-30T09:15:58Z")

</div>

Sorry not sure what the problem is, I was able to stage below as normal. Did you remember to Export HTML from the File menu in PsychoPy?

> **[HL\_ensemble\_prestim \[PsychoPy\]](https://run.pavlovia.org/thewhodidthis/hl_ensemble_prestim/)**

---

<div class="post-metadata">

**Author:** ![2clarkmoore2](https://avatars.discourse-cdn.com/v4/letter/2/7ab992/32.png) [@2clarkmoore2](https://discourse.psychopy.org/u/2clarkmoore2)\
**Post date:** [October 2, 2020, 2:05am UTC](https://discourse.psychopy.org/t/not-able-to-run-experiment-online/16872/8 "2020-10-02T02:05:35Z")

</div>

Did not know to do this but I tried it. It seems I have an index html file but that is it. Not sure if I am supposed to have more than that. Either way it still does not work. Besides exporting as an html file is there anything else I need to be doing to get this to run? Thank again for the help

---

<div class="post-metadata">

**Author:** ![2clarkmoore2](https://avatars.discourse-cdn.com/v4/letter/2/7ab992/32.png) [@2clarkmoore2](https://discourse.psychopy.org/u/2clarkmoore2)\
**Post date:** [October 2, 2020, 2:13am UTC](https://discourse.psychopy.org/t/not-able-to-run-experiment-online/16872/9 "2020-10-02T02:13:29Z")

</div>

also here is my github I changed the permissions so if you request access you may view.

> **[Sign in](https://gitlab.pavlovia.org/users/sign_in)**
>
> Sign In/Register

---

<div class="post-metadata">

**Author:** ![sotiri](https://avatars.discourse-cdn.com/v4/letter/s/59ef9b/32.png) [@sotiri](https://discourse.psychopy.org/u/sotiri)\
**Post date:** [October 2, 2020, 8:55am UTC](https://discourse.psychopy.org/t/not-able-to-run-experiment-online/16872/10 "2020-10-02T08:55:51Z")

</div>

OK great, thanks for giving me access to your repo. I created [a fork for it](https://gitlab.pavlovia.org/thewhodidthis/hl_ensemble_pilot), cloned it on my computer, opened `HLensemble_prestim.psyexp` in PsychoPy, hit the “Run the study online (with [pavlovia.org](http://pavlovia.org))” button and that was all I had to do to get past the 403 you posted about initially.

However, I believe there are some issues with how you specify “allowed keys” in your keyboard components, which I sort of had to patch to get the JS to run. Please [consult the manual](https://www.psychopy.org/builder/components/keyboard.html) for more details on how to use the keyboard component in PsychoPy.

> **[HLensemble\_prestim \[PsychoPy\]](https://run.pavlovia.org/thewhodidthis/hl_ensemble_pilot/)**

Please let me know if you need more help, thanks 😊

---

<div class="post-metadata">

**Author:** ![2clarkmoore2](https://avatars.discourse-cdn.com/v4/letter/2/7ab992/32.png) [@2clarkmoore2](https://discourse.psychopy.org/u/2clarkmoore2)\
**Post date:** [October 3, 2020, 3:02am UTC](https://discourse.psychopy.org/t/not-able-to-run-experiment-online/16872/11 "2020-10-03T03:02:19Z")

</div>

Hello Sotiri, thank you so much (again lol) for your help. In trying to fix my allowed keys component I actually solved another issue that I had run into (so thanks for this). However, I do feel like I may be missing something here. What exactly did you do to the key component to get the JS to work? The one issue that seems weird to me is when I put ‘return’ into the first routines key component I get an error message about my python syntax. This is strange because the examples in the key component are ‘left’, ‘right’ and these seem to work fine. When I put [‘return’] I dont get the same error message and this seems to works just fine.

Either way, I still can’t seem to get my project to run online the way you did. I clicked on fork in gitlab and doesn’t seem to do much. Feel like I am still missing something here to get past this 403 error message. Im so close! I can almost feel it!

---

<div class="post-metadata">

**Author:** ![wakecarter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/wakecarter/32/5753_2.png) [@wakecarter](https://discourse.psychopy.org/u/wakecarter)\
**Post date:** [October 4, 2020, 1:59pm UTC](https://discourse.psychopy.org/t/not-able-to-run-experiment-online/16872/12 "2020-10-04T13:59:14Z")

</div>

I think there’s a new bug in 2020.2 which means that you can’t have a single item in allowed keys, because it is expecting a list.

i.e.  
‘return’,‘space’ is fine  
‘return’,‘return’ is fine  
[‘return’] is fine  
‘return’ is not clearly a list and gives an error.

---

<div class="post-metadata">

**Author:** ![2clarkmoore2](https://avatars.discourse-cdn.com/v4/letter/2/7ab992/32.png) [@2clarkmoore2](https://discourse.psychopy.org/u/2clarkmoore2)\
**Post date:** [October 5, 2020, 5:46am UTC](https://discourse.psychopy.org/t/not-able-to-run-experiment-online/16872/13 "2020-10-05T05:46:45Z")

</div>

This is great to know thank you for this clarification!

---

<div class="post-metadata">

**Author:** ![sotiri](https://avatars.discourse-cdn.com/v4/letter/s/59ef9b/32.png) [@sotiri](https://discourse.psychopy.org/u/sotiri)\
**Post date:** [October 5, 2020, 11:38am UTC](https://discourse.psychopy.org/t/not-able-to-run-experiment-online/16872/14 "2020-10-05T11:38:03Z")

</div>

@wakecarter Thanks for flagging, our Python team are aware of the problem, please bear with us a patch is on the way. @2clarkmoore2 Looking at the structure of your project, which includes an html folder, does [https://run.pavlovia.org/2clarkmoore2/hl\_ensemble\_pilot/html](https://run.pavlovia.org/2clarkmoore2/hl_ensemble_pilot/html) also lead to a 403?

---

<div class="post-metadata">

**Author:** ![aisa2](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/aisa2/32/8666_2.png) [@aisa2](https://discourse.psychopy.org/u/aisa2)\
**Post date:** [October 13, 2020, 8:45pm UTC](https://discourse.psychopy.org/t/not-able-to-run-experiment-online/16872/15 "2020-10-13T20:45:17Z")

</div>

In the meantime, I found that ‘return’, (with a comma after the allowed key) seems to work.

---

<div class="post-metadata">

**Author:** ![2clarkmoore2](https://avatars.discourse-cdn.com/v4/letter/2/7ab992/32.png) [@2clarkmoore2](https://discourse.psychopy.org/u/2clarkmoore2)\
**Post date:** [October 14, 2020, 2:59pm UTC](https://discourse.psychopy.org/t/not-able-to-run-experiment-online/16872/16 "2020-10-14T14:59:06Z")

</div>

Hello, Yes it seems that the html leads to a 404 which is interesting. I added the html folder in gitlab manually. Not sure if psychopy was supposed to create a folder like that automatically. Is there anything else I can try to get this to work? Thank you! It does give me hope that you were able to put it online successfully.

---

<div class="post-metadata">

**Author:** ![2clarkmoore2](https://avatars.discourse-cdn.com/v4/letter/2/7ab992/32.png) [@2clarkmoore2](https://discourse.psychopy.org/u/2clarkmoore2)\
**Post date:** [October 21, 2020, 5:33pm UTC](https://discourse.psychopy.org/t/not-able-to-run-experiment-online/16872/17 "2020-10-21T17:33:49Z")

</div>

Hello all so I see a new issue in this which may be causing the problem - in Sotiri’s above posting of my project it seems to run okay until it gets to a variable E which I have defined in a code component called E = randint(0,2). When the code gets to this part it displays the error message “Reference error: E is not defined”.  
Then when I try to run my code in local debug mode I get a similar but different error - “Reference error: randint() is not defined”. Is it possible that I am having an issue converting python’s numpy to java? Shouldn’t builder mode be making this conversion when running online?

---

<div class="post-metadata">

**Author:** ![wakecarter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/wakecarter/32/5753_2.png) [@wakecarter](https://discourse.psychopy.org/u/wakecarter)\
**Post date:** [October 21, 2020, 6:32pm UTC](https://discourse.psychopy.org/t/not-able-to-run-experiment-online/16872/18 "2020-10-21T18:32:32Z")

</div>

Have you looked at my crib sheet? You need to define randint in code\_JS

---

<div class="post-metadata">

**Author:** ![2clarkmoore2](https://avatars.discourse-cdn.com/v4/letter/2/7ab992/32.png) [@2clarkmoore2](https://discourse.psychopy.org/u/2clarkmoore2)\
**Post date:** [October 21, 2020, 9:31pm UTC](https://discourse.psychopy.org/t/not-able-to-run-experiment-online/16872/19 "2020-10-21T21:31:26Z")

</div>

Hi thanks for the response - yes I did see the crib sheet and attempted to do this but didn’t work. It is likely I am going about it the wrong way. In the crib sheet youre saying I should create a code component in my very first routine, set it to JS only. One point I wasn’t clear on is where to put the code - do I put it in “before experiment” or “begin experiment” or “being routine”. Also how exactly should I input the code for defining randint(). Thank you for your help. The crib sheet will be very helpful in getting my experiment to work online once I can figure out how to implement it.

---

<div class="post-metadata">

**Author:** ![wakecarter](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/wakecarter/32/5753_2.png) [@wakecarter](https://discourse.psychopy.org/u/wakecarter)\
**Post date:** [October 21, 2020, 10:45pm UTC](https://discourse.psychopy.org/t/not-able-to-run-experiment-online/16872/20 "2020-10-21T22:45:43Z")

</div>

Before Experiment didn’t exist as a tab when I started the crib sheet. Begin Experiment is fine.

Copy and paste the code from the JS column.

[Next page](https://discourse.psychopy.org/t/not-able-to-run-experiment-online/16872.md?page=2)
