psychopy.org | Reference | Downloads | Github

Running PsychoPy 3.0.0 html on your own server?

At the moment PsychoPy 3.0.0 doesn’t export html, js and css that you can run on your own server. I can upload to Pavlovia, download the js and css files that Pavlovia generates and run those on my own server with the exported html and js files. But Pavlovia also generates some stuff that makes it impossible to run an experiment on my own server, so aside from this probably not being the way I should get js and css code to run an experiment on my own server, it doesn’t work.

Will it be possible at a later stage to export html in such a way from PsychoPy 3.0.0 that you can use it on your own server, the way it works in PsychoPy 1.90?

Kind regards,

Peter Loef

1 Like

Yes, I’m sure that will be possible, but:

  • it isn’t currently our priority
  • we haven’t yet documented how to do it (because it’s still open to change)
  • we will always very strongly recommend using pavlovia for both ease (no configuring permissions and databases) and security (e.g. https connection)

Thanks for the info Jon!

Kinds regards,

Peter Loef

I think you might be able to help me since you’ve successfully exported html using 1.90 version.

Is it able to be run on a local computer by just opening index.html that is produced? I get errors…

Also is psychopy able to convert code components to work with psychojs in version 1.90 and run in html automatically. Any guidance on this would be awesome, like should I be programming the code components in js…

Thanks,
Danyal

If you are serious about using the Javascript output, then you will need to be running PsychoPy 3. That capability in earlier versions was nothing more than a proof of concept and is severely limited.

I was able to get my code on a server and this is the error I get. I am wondering if you have seen this before.
It is an error with the io.js it seems.

Uncaught { “function” : “io.ResourceManager.getResource”, “context” : “when getting resource”, “error” : “unknown resource: http://fischerlab.johnshopkins.edu/Data/gonogo_pracround/html/resources/img/dollar.png”, “stack” : "Error\n at psychoJS.io.ResourceManager.getResource (http://fischerlab.johnshopkins.edu/Data/gonogo_pracround/html/js/psychojs/io.js:265:80)\n

Thanks,
Danyal

Hey danyalb,

Well, using the 1.90 version’s export to html version was pretty much a bust. The first time I had to manually close a couple of if statement bodies, the second time I had to take out all my PsychoPy code parts for it to still not work. So I gave up. Right now I think the best way to run PsychoPy js on your own server is to upload to Pavlovia from PsychoPy 3 and then download all the dependencies that it creates, which you can find in the source of your html when your code is on Pavlovia. You’d still need to solve how it uses the the json file which points to gitlab, but it’s probably way better js code than 1.90 generates.

By the way, I switched to jsPsych for now. That works very well. The only thing I still need to figure out about it though, is whether jsPsych takes framerates into account, which PsychoPy’s js seems to do. In any case, there’s articles out there saying that jsPsych is suitable for reaction time experiments.

Kind regards,

Peter Loef

I need to run a server of my own because I will be running an experiment at a school with poor internet access. And I prefer to run on the browser with a local server because there will be several computers and I need a way to quickly change the code in only one place if needed.
Unfortunately, I need PsychoPy3 because I will be using some Code Components with JS code.
I’ve been looking into this and it seems to me that the psychojs library (psychojs.3.0.0alpha3.js) that PsychoPy3 html and js files rely on is expecting a php server different from the one available in https://github.com/psychopy/psychojs. For example, at some point psychojs.3.0.0alpha3.js seems to call the server with an ‘experimentFullPath’ parameter which the server.php script available from github doesn’t seem to understand.
Can you please provide the server which you are running in pavlovia.org? If I’m not wrong, that seems to be the missing piece to have this running locally.
Thank you for your help!

Yes, the server script is different now (it’s actually now a python server instead of PHP) but it’s also receiving quite constant changes. We’ll make something available when it’s all settled down but, for now, supporting people on their own servers as well is going to slow down our direct work on making things work smoothly on pavlovia.

Best wishes,
Jon

1 Like

Peter is also right that the psychojs lib is improving a lot at the moment; we’re just about to release a modular ESMA6 version that will have superior performance but will also result in slight changes to the syntax. I’m fairly confident that the system will ultimately have superior performance to jsPsych and be easier to use (because of Builder) but jsPsych is certainly more stable at this point.

Well, you could make the server code available even if it isn’t all settled down. That would help people in my situation (two at my small lab) stick to PsychoPy instead of having to learn and migrate to jsPsych. Unfortunately, we cannot use Pavlovia in our experiments because we can’t rely on the internet connection here. Thanks

Could you please open source the server code because we live in Toronto and need to host our data in Canada.

Can you give any timeline when the new server code will be available? Thanks!!

No. It isn’t imminent though. As I say, this isn’t a high priority for us right now

Maybe as a work around - can you suggest any good routine (ideally automatized) for immediatly (after the participant has finished the study) sending the participant data from the pavlovia gitlab server to a different one and deleting the files on the pavlovia server?
Cheers!