How does Pavlovia know to make a new experiment? Different uploads replacing existing experiments

Hi folks.

This problem has plagued me since I started using Pyschopy. So It’d be great to understand this problem.

I often run experiments where I use Qualtrix to randomly distribute people to different Psychopy experiments - each experiment representing a different condition in a between subjects design. As such these different experiments are often very similar and just have a small difference.

Thus when coding, I will usually write the experiment for condition A , then copy this entire folder and rename it for Condition B and then make the required changes for this condition.

When I upload these two experiment to Pavlovia, often Experiment B will just overwrite the existing Experiment A on Pavlovia. I have spent ages mucking around trying to figure out how Pavlovia recognises that the current upload (instigated by the ‘Sync’ button) is a NEW and different experiment to what was there previously. This process is fraught and I usually get there by mucking around - but I have no clear idea of what the ‘marker’ is that Pavlovia uses to detect a new experiment - or match with a current one.

I have tried changing the name of the local folder of the experiment, the name of experiment file itself, and the experiment name within the Psychopy application (accessed via the cog icon).

None of these approaches reliably work.

So… what change should I make to a experiment - in order for Pavlovia to see it as a new experiment and not write over another (similar in structure), existing experiment.

Thanks for any insight into this.

Regards,

D.

Actually, a follow-up question.

So I have discovered the ‘New’ item in the "pavlovia.org’ menu. Which has a ‘Create new project’ button.

Perhaps this is what I should use when starting a new project?

Anyway I have now tried this, wtice - but it’s throwing an error. Text below.

Any ideas?

Thanks.

Traceback (most recent call last):
File “urllib3/connectionpool.pyc”, line 384, in _make_request
File “”, line 2, in raise_from
File “urllib3/connectionpool.pyc”, line 380, in _make_request
File “http/client.pyc”, line 1331, in getresponse
File “http/client.pyc”, line 297, in begin
File “http/client.pyc”, line 258, in _read_status
File “socket.pyc”, line 586, in readinto
File “urllib3/contrib/pyopenssl.pyc”, line 298, in recv_into
socket.timeout: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/requests/adapters.py”, line 449, in send
File “urllib3/connectionpool.pyc”, line 638, in urlopen
File “urllib3/util/retry.pyc”, line 367, in increment
File “urllib3/packages/six.pyc”, line 686, in reraise
File “urllib3/connectionpool.pyc”, line 600, in urlopen
File “urllib3/connectionpool.pyc”, line 386, in _make_request
File “urllib3/connectionpool.pyc”, line 306, in _raise_timeout
urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host=‘gitlab.pavlovia.org’, port=443): Read timed out. (read timeout=3)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/app/pavlovia_ui/project.py”, line 151, in submitChanges
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/psychopy/projects/pavlovia.py”, line 325, in createProject
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/gitlab/exceptions.py”, line 251, in wrapped_f
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/gitlab/mixins.py”, line 204, in create
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/gitlab/init.py”, line 604, in http_post
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/gitlab/init.py”, line 481, in http_request
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/requests/sessions.py”, line 646, in send
File “/Applications/PsychoPy.app/Contents/Resources/lib/python3.6/requests/adapters.py”, line 529, in send
requests.exceptions.ReadTimeout: HTTPSConnectionPool(host=‘gitlab.pavlovia.org’, port=443): Read timed out. (read timeout=3)

@jon or @apitiot could probably give you a definitive answer, but my understanding is that an ‘experiment’ just corresponds to a single GitLab repository. So if you are uploading things to the same repository, then it would not be recognized as a new experiment. I assume the “create new project” button in PsychoPy tries to create a new repository on GitLab. The error you’re getting is just that Pavlovia is taking too long to respond, probably related to the recent issues Pavlovia has been having with bot traffic (there are several posts around the forum about this), so try it at a different time of day or wait a couple days and see if it works then.

Worst case you can manually force it to make a new experiment by going to https://gitlab.pavlovia.org/ and clicking “new project” there, which will create a blank repository where you can manually upload a PsychoPy experiment generated by the builder. I don’t think you could get PsychoPy to sync with a repository you created this way, but you can use the “generate JS code” button and then upload the file it creates through a simple drag-and-drop (along with any media files). When you go to your Pavlovia dashboard it will then appear in your experiments and you can manage it normally.

@Dan_Conway I think the issue you’re seeing is that when you “copy the entire folder to a new location” you copy a hidden file inside it called .git. That folder contains all the history of the project but also information for PsychoPy about the location/name of the project on the server. So, as far as PsychoPy is concerned, you’ve just moved your project locally but we can still sync to the same remote location.

There are at least two solutions:

  • create a new folder and move the contents of the original to that rather than duplicating the folder itself. When you do that you usually don’t copy the hidden .git folder. By turning on view hidden files you can check whether it’s moved with you
  • OR given that your experiment changes only a little between different runs, the most efficient thing to do would be to have a single experiment but use an Experiment Settings variable to control that small change:
    • add a variable to your Experiment Settings (something like “group” but call it whatever makes most sense) and in your experiment use some code like
      if expInfo["group"] == "group1":
      ...
    • then in your url to the experiment you can add ?group="group1" to the end, which will control which group the participant is assigned to

The second approach involves more cognitive effort but the advantage is that you don’t end up with a proliferation of folder/projects/experiments that you have to keep track of later

TODAY

Ok. So, following a suggestion from @Becca, I tried using the Builder window: Pavlovia menu > New dialog box – but this time not including a fullstop in the Project name. And… it enabled the OK button. However, when I then clicked it, Pyschopy thought for a while – nothing appeared in the runner – and then the dialog disappeared and I was returned to the main screen. Going into Pavlovia, I now see a project with the name I just entered. Great. BUT… when I now hit ‘Sync’ I get the following error message:

<image 1>
IMAGE 1

???

Questions:
Is the Pavlovia menu > Sync the same thing as the icon in the top of builder? Does the ‘Sync’ button – if no project has been set up – do the same things as ‘Pavlovia menu > New’? And is this the same thing as ‘Builder Icon ‘Info/View Details’ > ‘Project Info’ dialog box: ‘+ Create’?

Do I need to somehow log in (or connect somehow) specifically within PsychoPy to Pavlovia? It would seem I can create a project on Pavlovia – but then syncing does not find that project.

Using the ‘Builder Icon ‘Info/View Details’ > ‘Project Info’ dialog box: ‘+ Create’ – does same thing as above – I get a spinning wheel progress incidator for a few seconds – but nothing appears in the runner. Then the dialog box looks like this:
<image 2>

Great. Now when I press ‘Sync’ in this dialog box – still open – NOW it seems to work! Including feedback within the Runner window.

BUT…

When I go to pavlovia, open the project and ‘View Code’. It seems to have some older versions of files here – from 19 hours ago. Comments are from uploads I was trying to do yesterday. Hmmmm…

OK – NEW APPROACH.
Based on the suggestion from @jon above I have now tried manually creating a new folder structure and copying only the absolutely necessary files across. Booted the project, used the info/View details dialog box and then clicked ‘+ Create’, then ’Sync’ and this all seemed to work. (also avoided fullstops in filename). On Pavlovia a new project is now there – and the view code button shows the comments I made during this sync operation. Great. BUT… when I now try to pilot the experiment, I get:
<image 3>
IMAGE 3

Note: Pavlovia appears to think that I am logged in. I can view my experiments, I have a ‘Log out’ option at the top of the screen etc…

This is ridiculous.

Can anyone answer any of these questions or suggest a way forward.

Thanks.

D.

Is the Pavlovia menu > Sync the same thing as the icon in the top of builder?

yes

Does the ‘Sync’ button – if no project has been set up – do the same things as ‘Pavlovia menu > New’? And is this the same thing as ‘Builder Icon ‘Info/View Details’ > ‘Project Info’ dialog box: ‘+ Create’?

Yes, if you’re creating the project within PsychoPy (rather than on the website) then all these routes will automatically go through the same steps for you

Do I need to somehow log in (or connect somehow) specifically within PsychoPy to Pavlovia? It would seem I can create a project on Pavlovia – but then syncing does not find that project.

You do need to log into Pavlovia from PsychoPy, but I believe you have done already

BUT… when I now try to pilot the experiment, I get:
<image 3>

I don’t know how you tried to access the URL to pilot your study but my guess is that it wasn’t set to be in piloting mode or you hadn’t pressed the button to get a pilot URL for this study. You need to set the status to Piloting and then press the Pilot button (next to View Code) on your dashboard for this project as in the screenshot below:

Hope that helps
Jon

Hi, I’ve been following this thread as I also have exactly the same issue as Dan. I also get the “403 Forbidden” error when trying to pilot my “new” Pavlovia project (I only copied over the necessary files and all seems okay when viewing code). Have you solved this issue now, Dan? I know this thread is nearly 2 months old… Thank you.

Ok. I have had endless more trouble with this. A long, widly frustrating story follows below.

Prolific Project sync/uploading Bug(s).

I am trying to upload a project to Pavlovia. Note this project was previously uploaded and ran fine. I have since deleted the previous versions from Pavlovia using the ‘Dashboard’ interface. Now trying to upload this again. I have tried this a bunch of times now so the starting state for below includes a version seemingly uploaded.

Current version of project on Pavlovia (note caps):

image

When I use the ‘cog’ icon within Psychopy for project properties (note caps):

image

Project name and folder structure locally (note caps):

image

BUT…

When I use the ‘I’ button on the left hand side of builder. I get the message:

image

Why is this lower case? And this suggests that this particular function (whatever it’s doing) is case sensitive.

I now attempt to create a project (note lower case):

image

And then I get this message:

image

Which suggests that THIS particular process (whatever it is) is NOT case sensitive!

ARGH!!!

So where do I set the project name? In the cog wheel dialog box? In the ‘i’ (view details of this project) dialog box? In the experiment filename? When pressing ‘Sync’ for the first time? It would appear that all these things can be totally different and it is impossible to know which is correct or which is actually used for creating the Pavlovia file.

This part of the process is a total mess.

Can we please have a single source of truth for what the project is called and make it either case sensitive or NOT – and then tell people what the rules are around creating project names (as in explicit in the UI) and also a single way of syncing and uploading projects?

ALSO – somehow – at some point – psychopy appears to be converting underscores into dashes. I have lost track of exactly when and at what point this happens – but I have deleted all previous Pavlovia versions, and tried naming the project at all points: “dpcl2_2-brief-b” but then after using the ‘I’ button to create a pavlovia project, and then going to sync for the first time I get this error:

image

Note the dash and underscore difference. I swear I have been entirely consistent and this was somehow changed by psychopy or Pavlovia. This is a kafka-esque level of absurd.

Ah ok. So I have (again) set the project name in the cog icon menu to be ‘dpcl2_2-brief-b’ saved and closed the project. Deleted the previous attempts at uploads on Pavlovia. Open the project again, click the ‘I’ button and get this error:

image

Why on earth has that first underscore been changed to a dash?

WHERE IS it getting this from??? Some vestigial filename not properly deleted on Pavlovia? Is there some OTHER place in psychopy that stores the project name?

Ugh.


Ok. So I close Psychopy, delete previous projects with any related names from Pavlovia, then copy the entire local folder structure and rename the root.

image

I rename the PsychoPy Project to something completely new: ‘for_doco_2_2_b’, open the project, and click the cog wheel icon. I see that it has retained the previous project name. Ok. That’s fine and kind of expected. So I now change this project name to the same as the project name: ‘for_doco_2_2_b’. Click ‘Save’. I now click on the ‘Sync with Web project’ button and Psychopy opens the following dialog box suggesting that it is trying to upload this to an already existing project? What? What project has it found that it is trying to update? Based on what filename?

image

Ah. Ok. This is interesting. I cancelled out of the above – and instead used the ‘i’ button and immediately get this:

image

So it’s clear that somehow – SOMEWHERE – an old project name is being retained. Note this is after copying the entire local folder structure to a new location, renaming the Psychopy project, opening it, changing the name in the ‘cog icon’ dialoge box, and then saving the project. So WHERE is this old filename being stored / retained? Coz I suspect THIS is the cause of much of these problems.

And how? – oh HOW??? … do I blow this away and upload this new project?

@wakecarter

Did you know that every project that you sync with Pavlovia needs to be in a separate local folder?

There are files that get automatically created when you sync in the hidden .git folder which contain information about the experiment. To create a new project based on an old one copy the psyexp file and resources to a new location and sync from there.

Hi Dan,

Copy your project to a new location, without including the .git folder and give it a name with an additional numeral to indicate the project version

Sorry to hear you’re having trouble on this. I can answer some of your questions, certainly about when a project name is decided and about where information about projects is being stored. Some of the answers I’m not sure of and haven’t seen before (e.g. the underscore being converted to a hyphen)

Also note that we have made some steps in improving this in recent versions. It looks like you’re using 2022.2 so you could try upgrading to 2023 and some of these issues (like the gitlab id error) may have been resolved.

Now, the questions I can answer, to provide a fuller understanding:

How does a project name get created?

This is done on your first push to the project, when PsychoPy asks to create a new project

Is a project name case sensitive? What is a valid name?

You can use a range of characters in the project title and those will be preserved BUT these cannot be used to distinguish projects because that name is used to create a valid URL and THAT will be lower case and certain characters (like spaces, which are converted to hyphens when making URLs) will be converted to make a more reasonable URL. I don’t think there’s any issue with hyphens and underscores though. Both of those are valid and permitted in both the title and the resulting URL

As an example, see demos / The Attention Network Task · GitLab which was given the project title “The Ant Network Task” but needed to be sanitised to “the-attention-network-task” for its URL. This does mean you cannot create different projects that differ only in letter case (like “The ANT network task”) because they can’t be given a unique URL (unless we do something like starting to add numerals at the end in the URL).

For the same reason you cannot include certain characters in the title, like punctuation, when creating the project. Those characters won’t make a valid URL

Where does PsychoPy store information about projects/names/ids?

There is information in a few places and PsychoPy will do its best to make sense of whatever it finds available:

  • in the .git/config file inside the project folder is the information that all git projects store, including information about their “remote” location (called the “origin” in the case of pavlovia projects). You need to turn on viewing of hidden files to find this because .git is usually hidden
  • in your ~/.psychopy3/pavlovia/knownProjects.json file (or %APPDATA%/psychopy3/pavlovia/knownProjects.json on Windows) which tracks a list of files on the local machine that PsychoPy has previously loaded and their respective locations
  • on gitlab itself (but that’s the one you successfully killed)

I believe these different locations are useful in different ways. For instance:

  • if you want to move your entire folder to a new location on your local disk, you can simply drag it somewhere new and (because the .git/config file will move with it) PsychoPy will still know how to sync your project with Pavlovia despite its change in location
  • if you want to overwrite all online files with your local files, e.g. if you had a merge problem and want your local files to be the truth you can delete the project remotely and re-sync - you’ll keep the full history of changes and also keep the same URL (because the info was in .git/config)
  • if you want to re-sync the local copy of your files (that you synced before and can’t remember where) then PsychoPy knows where your local copy of that project was last stored (because of the knownProjects.json file

So I believe we need the project details stored in more than one place.

How can I easily duplicate a project to Pavlovia?

If that’s the aim, then these steps should do it:

  • create a new folder and copy the contents of your existing project to that folder not including the .git file (By default, with .git hidden, selecting all and copying will not include it, whereas copying the folder will include hidden files). Alternatively you could copy the entire folder but then go and delete the hidden .git folder within it but that means turning hidden files on/off so I prefer the first method
  • give it a name with a numeral appended to identify which copy of the project this is

We could certainly look at creating a UI control for doing this within the app. What would the ideal User Interface look like for you? Maybe within the PsychoPy project dialog should have a “duplicate project” button but then I think we’ll need a dialog box “wizard” to check which of several subtely different options the user needs (new local copy with same remote? new remote copy from the same local location? new local and new remote?)