# Doesn't running on Pavlovia. Maybe a problem to read a code

**URL:** <https://discourse.psychopy.org/t/doesnt-running-on-pavlovia-maybe-a-problem-to-read-a-code/27513>\
**Category:** Online experiments\
**Tags:** code, pavlovia\
**Created:** [February 18, 2022, 3:00pm UTC](https://discourse.psychopy.org/t/doesnt-running-on-pavlovia-maybe-a-problem-to-read-a-code/27513 "2022-02-18T15:00:14Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gustavo\_Campelo](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.psychopy.org/gustavo_campelo/32/32503_2.png) [@Gustavo\_Campelo](https://discourse.psychopy.org/u/Gustavo_Campelo)\
**Post date:** [February 18, 2022, 3:00pm UTC](https://discourse.psychopy.org/t/doesnt-running-on-pavlovia-maybe-a-problem-to-read-a-code/27513/1 "2022-02-18T15:00:14Z")

</div>

URL of experiment: [Gustavo Campelo / Interferência Teste Final · GitLab](https://gitlab.pavlovia.org/GustavoCampelo/interferencia-teste-final.git)

Description of the problem:

Hi,

My experiment is not running online. On Psychopy it runs properly, but on Pavlovia is gets stucked on “Initiating the experiment”. What could I do to fix this?

The experiment starts with a simple text and a keyboard, like all experiments I’ve made. Then starts a loop with a sequential loop type. The only thing that should be diferent it’s because I had to put a code to randomize the time of each stimulum and other to make a pause aftter a number of responses.

code\_3:  
from numpy.random import random, randint, normal, shuffle  
current\_jitter = round(random() \* (4.0 - 0.5) + 0.5,1)  
thisExp.addData(‘fix\_time’, current\_jitter) # record in the data for this trial

code\_5:  
trialCount=0  
breakTrials = [24, 48, 72, 96, 120, 144, 168]  
Begin Routine: trialCount = trialCount+1

 ![image](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/9/8/981856a1511a07271fdd2a4365c9ff085d340dcd.png)  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/4/5/45fa14471b4e9136fc688c42a898c7a57663d449.png)  
 ![image](https://us1.discourse-cdn.com/flex002/uploads/psychopy/original/3X/2/3/235278c0dc8ae017a096d4b5c270ee820c5e0fd3.png)

Thank you

---

<div class="post-metadata">

**Author:** ![tkraus](https://avatars.discourse-cdn.com/v4/letter/t/b38774/32.png) [@tkraus](https://discourse.psychopy.org/u/tkraus)\
**Post date:** [February 18, 2022, 5:23pm UTC](https://discourse.psychopy.org/t/doesnt-running-on-pavlovia-maybe-a-problem-to-read-a-code/27513/2 "2022-02-18T17:23:45Z")

</div>

You cannot use numpy. There is no equivalent library that JS could import.

I’m actually not sure how to get a nice jitter without that. Maybe use “random.gauss( mu , sigma)”…?

Also, take a look at the following document to see what to do and what not to do when coding:

> **[PsychoPy Python to Javascript crib sheet 2021](https://docs.google.com/document/d/183xmwDgSbnJZHMGf3yWpieV9Bx8y7fOCm3QKkMOOXFQ/edit#)**
>
> PsychoPy version 2021.1.3-2021.2.3Python to JavaScript Crib Sheet Compiled by Wakefield Morys-Carter, Oxford Brookes UniversityPlease share widely and follow Psych\_Stats on twitter. PsychoPy 2021 is a major update with several new features. When...
