| Reference | Downloads | Github

My experiment doesn't initiate in pavlovia

URL of experiment:

Description of the problem: Does anyone know why my experiment doesn’t initiate in pavlovia? It would be great if anyone can help me on that

I have the same issue with my experiment, and i have found the reason to be with the Python code, which automatically converts to Javascript (.JS file), does not support few functions / script lines which we have used on the Python side. mainly with the Import Libraries. I am looking for other means on how to get about it, and i am still trying. Hope this helps you with identifying the issue.

1 Like

Hi Janu
Have you found any solution?

Hi @negin, currently python libraries cannot be imported in js. If you are trying to import py libraries in js, that may be why it’s stuck on initializing. You’ll need to see if there are equivalent js libraries you can use instead, and switch code components from “Auto>js” to “Both” and adjust manually.

If you aren’t importing py libraries into js, it would be helpful to link to the gitlab (& make the project public) so that we can see your code and someone can help you!

Yes Negin, I was using two libraries: random and xlrd in python. I managed to use js functions instead of the auto js import * as libraries suggested.
I had to do a bit of re-coding in js for my work but it is finally working.

Yours seems to say “failed to load resourses”

in pavovia, go to view code —> html ------> resources.

check if all the necessary files are in it, else manually uplod to this folder. hopefully this is solve your issue.

Hi Sawal
Thanks alot for your answer and sorry for being late. I made the project public. Unfortunately it doesn’t have java sc even I changed the codes to both. Please help me if you can. Its really annoying. Here is the link of project.

Hi Janu
Thank you for your answer. I did the same but still there is no java script. in html file How can I have it? Can you help me on that? I made the project public.

Hi @negin, does your experiment run successfully locally (offline)?

A js file isn’t being created locally-- this means that js fails to successfully compile due to an issue with custom code components.

One thing to note is that you are using auto>js for random in your code components, which is fine for some of them, but not when importing py libraries.
For py “random”, you need to change auto>js to “Both” and then adjust the js side as described here.

I’m not able to successfully run your experiment locally so there are likely additional issues. Once you have a working local version, and have fixed the js code for random, go to “File” and then “export html” and check if a js file is created in the html folder.

Hello Sawal
It works offline and I really donot know what is the problem. I changed the code to both but still js was not appeared. :frowning: