Running a python script on pavlovia

URL of experiment:

Description of the problem:

I’ve programmed a task using the PsychoPy Coder and saved it as a “.py”-file (Or to be precise: Two “.py”-files, since I have a main-file and one that I’m importing functions from). It’s a bit of a complicated task, so the Builder didn’t give me all the options I needed.

The task works flawless offline when I run it with the PsychoPy Runner, it was tested several times. Now I uploaded the project to pavlovia and wanted to pilot it online. When trying to pilot it, I got the error message " 403 Forbidden". It was only then that I realized that pavlovia expects JavaScrip-Files. I probably should have done my research on that before, but now I’ve invested several weeks of programming and offline-piloting into this project. So I wanted to ask whether there’s an easier way to get this project running on pavlovia-servers than rewriting about 1500 lines of code?

Thanks in advance to everyone who takes their time to help me :slight_smile:

Hi

Is there a reason why you used Coder instead of Builder? My recommendation would be to rewrite your experiment in Builder using Auto-translate code components.

While you could try simply pasting all of your Python code into one Begin Experiment code component tab, this is highly unlikely to work and you will need to break it into parts. When the JS side doesn’t say syntax error you have a chance that it might work online.

It might be worth skimming through my crib sheet for some ideas about the kinds of Python code than don’t translate well.

Okay thank you for the quick answer.

The reason I used Coder instead of Builder is that it felt easier to me, since I’m a fairly experienced programmer in python, but never used something like the PsychoPy Builder before.
Also I liked the additional possibilities that gave me like multithreading or some numpy functions. But it seems like these are breaking my neck right now :smiley:

I’ll see what I do with this task and post my solution, maybe one day it’ll help someone.

So, actually the code was too “personal” to be easily put into a nice convertable format. At the end we decided not to run the piloting online. The final study was always meant to be run offline (with supervision etc.) anyway, we just considered pavlovia-servers for the piloting.

1 Like