Is it possible to sync code with Pavlovia?

My question is the same as that asked here: How can you upload an experiment to Pavlovia through coder view vs builder view?. Is it possible to sync a project from the Python code window to Pavlovia, rather than only being able to sync from the builder window (GUI)?

The only answer from the link above indicates that this is not possible. However, if that were the case, then many of the tips at this popular help document (thank you!) https://docs.google.com/document/d/13jp0QAqQeFlYSjeZS0fDInvgaDzBXjGQNe4VNKbbNHQ/edit?pli=1# would not make any sense, since the tips concern writing code that will be translated to JS.

Is the document above aimed at audiences who are using PsychoPy-to-JS services other than Pavlovia (and if so, what are these services)? If not, then the answer in the discourse link above must be incorrect or outdated. In that case, how does one sync Python code directly with Pavlovia (that is, not through the builder, but through the code window)?

Thank you!

Coder has a sync button right there on the toolbar:
image
Does that not work for you?

But if you’re wanting to run you’re study online, rather than merely share it, then uploading a python script won’t work. See Running and sharing studies online — PsychoPy v2021.2

Thanks for your reply!

I think I am confused. If you can’t run code in Pavlovia, then how would this document https://docs.google.com/document/d/13jp0QAqQeFlYSjeZS0fDInvgaDzBXjGQNe4VNKbbNHQ/edit?pli=1# be useful, since it helps troubleshoot code that translates to JS to then run online?

I have an experiment that runs perfectly locally via PsychoPy. I have the project uploaded to Pavlovia, and it will not run in Pavlovia. I am looking for a way to insert print statements in the online version so I can debug whatever issues are occurring in JS/on Pavlovia.

To answer your question, the sync button from the Builder of PsychoPy works, and seems to upload the correct experiment files to Gitlab to run (to both the root directory and the html directory). But when I click the sync button from the coder window, the files do not get uploaded to the html file in Gitlab/run in Pavlovia (only to the root folder, which, like you said, means they do not affect the Pavlovia experiment in any way).

Thanks again for your help, and please let me know if I can clarify anything (this is my first time trying to use PscyhoPy/Pavlovia).

That document is about converting code from a Code Component in the Builder. Basically, small snippets of code can be converted to some extent by the PsychoPy application but auto-converting an entire script is not possible (and won’t be). If you intend to run your study online you should create your experiment in Builder and just use the minimal amount of Python code that you need as Code Components within the Builder interface. That’s our recommendation anyway, but especially when running online

2 Likes