Freaking out: Unable to synchronize changes on new computer/Create new experiment

URL of experiment:
https://run.pavlovia.org/ayjayar/thesis7-30-21

Description of the problem:
For the life of me I cannot figure out what is going on! My first participant is coming this week and I cannot synchronize my (incredibly important) changes. The prior version (from two days ago) still works, but I can’t get any changes to synchronize.

I tried creating a new local folder and copying everything over except the .git folder and checked the experiment settings to make sure they use the same version. What else could be causing it to be unable to synchronize?

When I first tried to synchronize:

Pushing to Pavlovia for the first time...Traceback (most recent call last):
  File "C:\Program Files\PsychoPy\lib\site-packages\psychopy\app\pavlovia_ui\project.py", line 543, in syncProject
    status = project.sync(syncFrame)
  File "C:\Program Files\PsychoPy\lib\site-packages\psychopy\projects\pavlovia.py", line 654, in sync
    self.firstPush(infoStream=infoStream)
  File "C:\Program Files\PsychoPy\lib\site-packages\psychopy\projects\pavlovia.py", line 827, in firstPush
    info = self.repo.git.push('-u', self.remoteWithToken, 'master')
  File "C:\Program Files\PsychoPy\lib\site-packages\git\cmd.py", line 548, in <lambda>
    return lambda *args, **kwargs: self._call_process(name, *args, **kwargs)
  File "C:\Program Files\PsychoPy\lib\site-packages\git\cmd.py", line 1014, in _call_process
    return self.execute(call, **exec_kwargs)
  File "C:\Program Files\PsychoPy\lib\site-packages\git\cmd.py", line 825, in execute
    raise GitCommandError(command, status, stderr_value, stdout_value)
git.exc.GitCommandError: Cmd('C:\Program Files\PsychoPy\MinGit\cmd\git.exe') failed due to: exit code(1)
  cmdline: C:\Program Files\PsychoPy\MinGit\cmd\git.exe push -u https://oauth2:4ef98a8616117151a95007ff759554024ff7ace0dc789e25c6eb882e66e3ceb5@gitlab.pavlovia.org/ayjayar/thesis080121.git master
  stderr: 'remote: error: cannot lock ref 'refs/heads/master': reference already exists        
To https://gitlab.pavlovia.org/ayjayar/thesis080121.git
 ! [remote rejected] master -> master (failed to update ref)
error: failed to push some refs to 'https://oauth2:4ef98a8616117151a95007ff759554024ff7ace0dc789e25c6eb882e66e3ceb5@gitlab.pavlovia.org/ayjayar/thesis080121.git''

Pushing to Pavlovia for the first time...Traceback (most recent call last):
  File "C:\Program Files\PsychoPy\lib\site-packages\psychopy\app\pavlovia_ui\project.py", line 543, in syncProject
    status = project.sync(syncFrame)
  File "C:\Program Files\PsychoPy\lib\site-packages\psychopy\projects\pavlovia.py", line 654, in sync
    self.firstPush(infoStream=infoStream)
  File "C:\Program Files\PsychoPy\lib\site-packages\psychopy\projects\pavlovia.py", line 827, in firstPush
    info = self.repo.git.push('-u', self.remoteWithToken, 'master')
  File "C:\Program Files\PsychoPy\lib\site-packages\git\cmd.py", line 548, in <lambda>
    return lambda *args, **kwargs: self._call_process(name, *args, **kwargs)
  File "C:\Program Files\PsychoPy\lib\site-packages\git\cmd.py", line 1014, in _call_process
    return self.execute(call, **exec_kwargs)
  File "C:\Program Files\PsychoPy\lib\site-packages\git\cmd.py", line 825, in execute
    raise GitCommandError(command, status, stderr_value, stdout_value)
git.exc.GitCommandError: Cmd('C:\Program Files\PsychoPy\MinGit\cmd\git.exe') failed due to: exit code(1)
  cmdline: C:\Program Files\PsychoPy\MinGit\cmd\git.exe push -u https://oauth2:4ef98a8616117151a95007ff759554024ff7ace0dc789e25c6eb882e66e3ceb5@gitlab.pavlovia.org/ayjayar/thesis080121.git master
  stderr: 'remote: error: cannot lock ref 'refs/heads/master': reference already exists        
To https://gitlab.pavlovia.org/ayjayar/thesis080121.git
 ! [remote rejected] master -> master (failed to update ref)
error: failed to push some refs to 'https://oauth2:4ef98a8616117151a95007ff759554024ff7ace0dc789e25c6eb882e66e3ceb5@gitlab.pavlovia.org/ayjayar/thesis080121.git''```



When I tried to create a new experiment:

Pushing to Pavlovia for the first time…Traceback (most recent call last):
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\app\pavlovia_ui\project.py”, line 543, in syncProject
status = project.sync(syncFrame)
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\projects\pavlovia.py”, line 654, in sync
self.firstPush(infoStream=infoStream)
File “C:\Program Files\PsychoPy\lib\site-packages\psychopy\projects\pavlovia.py”, line 827, in firstPush
info = self.repo.git.push(’-u’, self.remoteWithToken, ‘master’)
File “C:\Program Files\PsychoPy\lib\site-packages\git\cmd.py”, line 548, in
return lambda *args, **kwargs: self._call_process(name, *args, **kwargs)
File “C:\Program Files\PsychoPy\lib\site-packages\git\cmd.py”, line 1014, in _call_process
return self.execute(call, **exec_kwargs)
File “C:\Program Files\PsychoPy\lib\site-packages\git\cmd.py”, line 825, in execute
raise GitCommandError(command, status, stderr_value, stdout_value)
git.exc.GitCommandError: Cmd(‘C:\Program Files\PsychoPy\MinGit\cmd\git.exe’) failed due to: exit code(1)
cmdline: C:\Program Files\PsychoPy\MinGit\cmd\git.exe push -u Sign in · GitLab master
stderr: ‘remote: error: cannot lock ref ‘refs/heads/master’: reference already exists
To Sign in · GitLab
! [remote rejected] master → master (failed to update ref)
error: failed to push some refs to ‘Sign in · GitLab’’


Any ideas?

Hi @ayjayar, you may have better luck creating a new project to sync to on Pavlovia, x

Hello,

it is not sufficient to delete the .git-folder. You also need to delete the .gitignore-file which might be set to hidden depending on your operating system. As an alternative, look at the server for a file called master.lock. You can delete it and then try syncing.

Best wishes Jens

1 Like

Thank you for the reply. That’s what led to the second sync error. It makes no sense to continue having issues. the only thing that had changed was a new computer, so I cloned the repository with github desktop and tried to resync. When that didn’t work, I tried remaking the experiment.

I tried copying over without the git folder and without gitignore and am still getting errors.

I don’t see any files with word “lock” anywhere in the repository on Pavlovia.

When I look at the last working version I have that works from start to finish it was from 2 months ago. I tried cloning it to a new experiment and synchronizing. When I did that, it edited the old experiment js file and is throwing the errors still.

When I look at the old file, I see a lot of the import code is getting changed. I assume from a recent software update? Mind you, starting about that time I also noticed it was no longer working in other web browsers, only Firefox.

I am 99% certain that the issue is related to a recent server or psychojs update.

I tried changing the settings to the previous psychopy that worked for me which was 2021.1.4, and now it is saying just saying “psychoJS.downloadResources is not a function”

@thomas_pronk

I’m looking at your eye tracking demo and noticed it is working fine on the previous psychojs version. We have nearly identical code except mine now is using PsychoJS 2021.2.0 and it keeps changing the import coding when I try to synchronize.

Yours:

 * Demo_Eye_Tracking2 Test *
 ***************************/

import { PsychoJS } from './lib/core-2021.1.4.js';
import * as core from './lib/core-2021.1.4.js';
import { TrialHandler } from './lib/data-2021.1.4.js';
import { Scheduler } from './lib/util-2021.1.4.js';
import * as visual from './lib/visual-2021.1.4.js';
import * as sound from './lib/sound-2021.1.4.js';
import * as util from './lib/util-2021.1.4.js';
//some handy aliases as in the psychopy scripts;
const { abs, sin, cos, PI: pi, sqrt } = Math;
const { round } = util;

// init psychoJS:
const psychoJS = new PsychoJS({
  debug: true
});

// open window:
psychoJS.openWindow({
  fullscr: true,
  color: new util.Color([0, 0, 0]),
  units: 'height',
  waitBlanking: true
});

... 
...
...

function experimentInit() {
  // Initialize components for Routine "loading_trial"
  loading_trialClock = new util.Clock();
  // Download the webgazer library and re-download seedrandom.js (since webgazer
  // overrides it with a version that conflicts with PsychoJS)
  psychoJS.downloadResources([
    { name: 'webgazer.js', path: 'js/webgazer-2.0.1.tp.js' },
    { name: 'seedrandom.js', path: 'https://cdnjs.cloudflare.com/ajax/libs/seedrandom/3.0.1/seedrandom.min.js' }
  ]);

Mine:

import { core, data, sound, util, visual } from './lib/psychojs-2021.2.0.js';
const { PsychoJS } = core;
const { TrialHandler } = data;
const { Scheduler } = util;
//some handy aliases as in the psychopy scripts;
const { abs, sin, cos, PI: pi, sqrt } = Math;
const { round } = util;

...
...
...

async function experimentInit() {
  // Initialize components for Routine "Introduction"
  IntroductionClock = new util.Clock();
  // Download the webgazer library and re-download seedrandom.js (since webgazer
  // overrides it with a version that conflicts with PsychoJS)
  psychoJS.downloadResources([
    { name: 'webgazer.js', path: 'js/webgazer-2.0.1.tp.js' },
    { name: 'seedrandom.js', path: 'https://cdnjs.cloudflare.com/ajax/libs/seedrandom/3.0.1/seedrandom.min.js' }
  ]);

Does anyone have ANY ideas how to fix this either by stopping it from changing the code besides manually editing the javascript code and potentially ruining future psyexp edits?

@ayjayar Are all git syncing issues resolved then? Within PyshoPy’s Builder you are given the option of fixing the project to the version of PsychoJS you most prefer, but could you try calling _downloadResources instead of downloadResources? Also, I see the main script in your project is importing PsychoJS 2021.2.0, but psychopyVersion is set to 2021.2.1, would you like to give me developer access so I can take a better look? Here to help, x

1 Like

@sotiri

Thank you greatly for your assistance sotiri. I reinstalled PsychoPy standalone to 2021.1.4 and was able to synchronize, but ran into that download resources issues afterwards.

I’ve reinstalled 2021.2.1 standalone, then cloned the last version I was working on. I edited it to psychojs._downloadResources but I’m running into those long errors again so I can’t see if the _downloadResources would work instead.

Here is what I get when I try to synchronize the 7-30-21 study

How can I enable developer access?

Thanks again.

Do any of these threads help?
https://discourse.psychopy.org/search?q=path%20too%20long%20for%20windows%20status:solved

1 Like

Thanks for the response. Reducing the number of elifs didn’t seem to help as you had suggested may be an issue in one of the threads. One of the responders in ValueError: stat: path too long for Windows - Online experiments - PsychoPy
suggested that he was encountering a problem because a component of his code was being passed into HTML. This is required for my experiment as I am using the participant and session number to determine what video is run.

I have gotten it working again by uninstalling PsychoPy 2021.2.1 and reinstalling 2020.2.5, which was the version that worked with my pilot data. It is also now working on other web browsers again. When I add the changes, it gives me roughly the same error again.

I’m having trouble getting anything to show up adding the line of code suggested by jon in ValueError: stat: path too long for Windows - Online experiments - PsychoPy.

It might be an issue with the number of elifs.

It works in this one:
Thesis [PsychoPy] (pavlovia.org)

I’m still messing with putting one more line at a time.

It appears it is an issue with number of elifs. When using 17 elifs, it works fine:

The original elif structure was this.

if (expInfo['participant'] == '1' && expInfo['session'] == '1')
       { 
        P1S1 = true;
        vidDur = 690; 
        }
        else 
            {
             if (expInfo['participant'] == '1' && expInfo['session'] == '2')
               {
                P1S2 = true;
                vidDur = 612;
                }
                else 
                    {
                     if (expInfo['participant'] == '1' && expInfo['session'] == '3')
                      {
                        P1S3 = true;
                        vidDur = 734;
                       }
                        else 
                            {
                              if (expInfo['participant'] == '1' && expInfo['session'] == '4')
                                {
                                P1S4 = true;
                                vidDur = 858;
                                 }
                                  else 
                                      {
                                       if (expInfo['participant'] == '1' && expInfo['session'] == '5')
                                         {
                                          P1S5 = true;
                                          vidDur = 893;
                                          }
                                           else 
                                                {
                                                  if (expInfo['participant'] == '1' && expInfo['session'] == '6')
                                                    {
                                                     P1S6 = true;
                                                     vidDur = 903;
                                                    }                         
                                                     else 
                                                         {
                                                          if (expInfo['participant'] == '1' && expInfo['session'] == '7')
                                                            {
                                                             P1S7 = true;
                                                             vidDur = 686;
                                                             }
                                                             else 
                                                                 {
                                                                  if (expInfo['participant'] == '1' && expInfo['session'] == '8')
                                                                    {
                                                                     P1S8 = true;
                                                                     vidDur = 619;
                                                                    }
                                                                    else 
                                                                        {
                                                                         if (expInfo['participant'] == '1' && expInfo['session'] == '9')
                                                                           {
                                                                            P1S9 = true;
                                                                            vidDur = 612;
                                                                            }
                                                                             else 
                                                                                {
                                                                                 if (expInfo['participant'] == '1' && expInfo['session'] == '10')
                                                                                   {
                                                                                    P1S10 = true;
                                                                                    vidDur = 802;
                                                                                    }
                                                                                    else 
                                                                                       {
                                                                                        if (expInfo['participant'] == '1' && expInfo['session'] == '11')
                                                                                          {
                                                                                           P1S11 = true;
                                                                                           vidDur = 669;
                                                                                           }
                                                                                            else                                                                                     
                                                                                               {
                                                                                                if (expInfo['participant'] == '1' && expInfo['session'] == '12')
                                                                                                  {
                                                                                                   P1S12 = true;
                                                                                                   vidDur = 100000;
                                                                                                   }
                                                                                                   else
                                                                                                      {
                                                                                                       if (expInfo['participant'] == '1' && expInfo['session'] == '13')
                                                                                                         {
                                                                                                          P1S13 = true;
                                                                                                          vidDur = 1000000;
                                                                                                          }
                                                                                                          else
                                                                                                             {
                                                                                                             if (expInfo['participant'] == '1' && expInfo['session'] == '14')
                                                                                                               {
                                                                                                                P1S14 = true;
                                                                                                                vidDur = 100000;
                                                                                                               }
                                                                                                                 else
                                                                                                                    {
                                                                                                                     if (expInfo['participant'] == '1' && expInfo['session'] == '15')
                                                                                                                       {
                                                                                                                        P1S15 = true;
                                                                                                                        vidDur = 100000;
                                                                                                                        }
                                                                                                                         else
                                                                                                                             {
                                                                                                                              if (expInfo['participant'] == '1' && expInfo['session'] == '16')
                                                                                                                                {
                                                                                                                                 P1S16 = true;
                                                                                                                                 vidDur = 100000;
                                                                                                                                 }
                                                                                                                                 else
                                                                                                                                     {
                                                                                                                                     if (expInfo['participant'] == '1' && expInfo['session'] == '17')
                                                                                                                                        {
                                                                                                                                         P1S17 = true;
                                                                                                                                         vidDur = 100000;
                                                                                                                                         }
                                                                                                                                      } //17
                                                                                                                               } //16
                                                                                                                          } //15
                                                                                                                 }   //14                                                                                                     
                                                                                                         } //13
                                                                                                } //12
                                                                                            }//11
                                                                                      }//10                                                                                  
                                                                             }//9
                                                                     } //8
                                                            }//7
                                                    }//6
                                             }//5
                                }//4
                       } //3
             } //2

It syncrhronizes, but when I put116 elifs… yeah 116… or even 29 elifs it gives me this error:

I edited the _experiment.py file per Jon’s suggestion and added
“try: os.path.isfile(thisFile[‘abs’])
except ValueError:
print(thisFile[‘abs’])” below line 841

Which resulted in this popping up when I try to launch the experiment

image
I’m not sure what that may tell me, unless I made the edit incorrectly.

What are your thoughts? At worst, I find out if there’s a maximum number of elifs and create multiple sessions I think. Any help would be appreciated.

Three thoughts

  1. You could just use a string of if statements instead of elifs to avoid the nested structure. Logically you only need to use elifs if you end on an else or if multiple statements can be true and you want to prioritise them. Actually if you are just setting P1S2 and vidDur you can prioritise using if statements by putitng the higher priority last.

  2. Put your conditionals into an Excel file and loop through with a code component that sets P1S2 and vidDur if the participant and session values match the expInfo versions.

  3. In a similar situation my solution was:

allOrders=['CABD','ACDB','CBDA','DBAC','BDAC','DCAB','ACBD','CDAB','DACB','DCBA','DABC','BCAD','BDCA','ADBC','ADCB','CADB','BCDA','CDBA','DBCA','BADC','CBAD','BACD','ABDC','ABCD']
thisOrder=allOrders[int(expInfo['participant'])%24]
thisFile=int(expInfo['session'])%4
Stimfile = 'stimfile_'+thisOrder[thisFile]+'.xlsx'

I think I’ve also added participant to session and taken the modulus but I can’t remember which experiment that was for.

1 Like

I feel so dumb. Getting rid of all the elifs and replacing with ifs fixed it!! Thank you all for all your help!

2 Likes