psychopy.org | Reference | Downloads | Github

Cannot sync to Pavlovia

URL of the experiment: https://pavlovia.org/bobbyTUCI/sandwichfinal

Description of the problem:
I have a project that was working fine on Pavlovia (link above), but when I closed PsychoPy (builder), and then reopened it, and then tried to sync a project it said I needed to recreate a project. This then was working fine for a while, but now when I try to resync or create a new project on pavlovia it gets stuck on synchornising, and I get the following error in my python console:
Traceback (most recent call last):
File “C:\Program Files\PsychoPy3\lib\site-packages\psychopy\app\builder\builder.py”, line 2471, in onPavloviaSync
retVal = pavlovia_ui.syncProject(parent=self, project=self.project)
File “C:\Program Files\PsychoPy3\lib\site-packages\psychopy\app\pavlovia_ui\project.py”, line 488, in syncProject
infoStream=syncFrame.syncPanel.infoStream)
File “C:\Program Files\PsychoPy3\lib\site-packages\psychopy\app\pavlovia_ui\functions.py”, line 96, in showCommitDialog
changeDict, changeList = project.getChanges()
File “C:\Program Files\PsychoPy3\lib\site-packages\psychopy\projects\pavlovia.py”, line 915, in getChanges
raise ValueError(“Found an unexpected change_type ‘{}’ in gitpython Diff”.format(this.change_type))
ValueError: Found an unexpected change_type ‘U’ in gitpython Diff

When I try to close psychopy and reopen it, or try creating a new project, I still get this same error. Everything runs fine from Psychopy on my computer, and no errors are generated when exporting the html file. Any help is much appreciated, as I am very much stuck at the moment.

If I try to sync from PsychoPy to the existing study above (Using the find existing study button) I get a different error:
Traceback (most recent call last):
File “C:\Program Files\PsychoPy3\lib\site-packages\psychopy\app\pavlovia_ui\project.py”, line 364, in onSyncButton
self.project.sync(infoStream=self.syncPanel.infoStream)
File “C:\Program Files\PsychoPy3\lib\site-packages\psychopy\projects\pavlovia.py”, line 651, in sync
status = self.pull(infoStream=infoStream)
File “C:\Program Files\PsychoPy3\lib\site-packages\psychopy\projects\pavlovia.py”, line 694, in pull
raise e
File “C:\Program Files\PsychoPy3\lib\site-packages\psychopy\projects\pavlovia.py”, line 685, in pull
info = self.repo.git.pull(self.remoteWithToken, ‘master’)
File “C:\Program Files\PsychoPy3\lib\site-packages\git\cmd.py”, line 548, in
return lambda *args, **kwargs: self._call_process(name, *args, **kwargs)
File “C:\Program Files\PsychoPy3\lib\site-packages\git\cmd.py”, line 1014, in _call_process
return self.execute(call, **exec_kwargs)
File “C:\Program Files\PsychoPy3\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\PsychoPy3\MinGit\cmd\git.exe’) failed due to: exit code(128)
cmdline: C:\Program Files\PsychoPy3\MinGit\cmd\git.exe pull https://oauth2:502452335f4c842ba48082dfd070b56b938937f427b739b429302ba993f50630@gitlab.pavlovia.org/bobbyTUCI/sandwichfinal.git master
stderr: 'error: Pulling is not possible because you have unmerged files.
hint: Fix them up in the work tree, and then use ‘git add/rm ’
hint: as appropriate to mark resolution and make a commit.
fatal: Exiting because of an unresolved conflict.’

The error in my first post is in trying to create the new project, this error is for trying to sync with the existing project.

@Bobby_Thomas, looks like you have a Git merge conflict. This appears when you change the same lines of code locally (from PsychoPy) and remotely (from Pavlovia). At this point, your easiest solution is clear your local repository (deleting .git folder), delete your remote repo (so long as you are not data collecting) and start again: Here are explicit steps:

Edit: To avoid merge conflicts, you should only amend code on using PsychoPy, rather than making changes through Pavlovia.

1 Like

Thanks that solved it, I’m now dealing with my code components not working with the newest update of PsychoPy, but that is for a separate post

Deleting everything and starting anew may not always be necessary when this happens.

I have edited the PsychoPy code in psychopy/projects/pavlovia.py as follows:

>diff -c pavlovia.py.org pavlovia.py
*** pavlovia.py.org     2020-03-28 02:29:48.000000000 -0400
--- pavlovia.py 2020-06-07 15:02:10.162859784 -0400
***************
*** 911,916 ****
--- 911,918 ----
                  changeDict['renamed'].append((this.rename_from, this.rename_to))
              elif this.change_type == 'M':
                  changeDict['changed'].append(this.b_path)
+             elif this.change_type in ['U','T']:
+                 raise ValueError("Change type '{}' not supported (file: {}) in gitpython Diff".format(this.change_type, this.b_path))
              else:
                  raise ValueError("Found an unexpected change_type '{}' in gitpython Diff".format(this.change_type))
          changeList = []

Basically, it adds the filename to the error message, so instead of:
ValueError: Found an unexpected change_type 'U' in gitpython Diff
you get:
Change type 'U' not supported (file: filename.ext) in gitpython Diff
I find this extra information helpful, as often it is only necessary to delete and resync this one file, rather than the whole project.

Not sure if this is something the developers want to add to PsychoPy, but anyone who wants to give it a try can add the 2 lines of code to the same file, restart PsychoPy, and try the sync again to get a more informative error message.

1 Like