qgis-plugin icon indicating copy to clipboard operation
qgis-plugin copied to clipboard

[windows] PermissionError - failed to sync project (unhandled exception) with Dropbox

Open DuKangaroo opened this issue 3 years ago • 14 comments

Hello, I'm getting the error as seen in the title. Reporting it so you can create an error handler for it. The cause of the error might be that I'm working from Dropbox - I'm not 100% sure. See the details below.

Traceback (most recent call last):

  File "C:/Users/Johnathan/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\Mergin\sync_dialog.py", line 306, in pull_timer_tick
    self.pull_conflicts = pull_project_finalize(self.job)

  File "C:/Users/Johnathan/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\Mergin\mergin\client_pull.py", line 553, in pull_project_finalize
    shutil.rmtree(job.temp_dir)

  File "C:\PROGRA~1\QGIS3~1.18\apps\Python37\lib\shutil.py", line 507, in rmtree
    return _rmtree_unsafe(path, onerror)

  File "C:\PROGRA~1\QGIS3~1.18\apps\Python37\lib\shutil.py", line 395, in _rmtree_unsafe
    onerror(os.rmdir, path, sys.exc_info())

  File "C:\PROGRA~1\QGIS3~1.18\apps\Python37\lib\shutil.py", line 393, in _rmtree_unsafe
    os.rmdir(path)

PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\Users\\Johnathan\\Dropbox (JJ Ryan Consulting P)\\Projects\\JJR-4210116A-MVCC\\02_Technical\\03_Internal\\Mapping\\Detailed Inspection Hybrid Map\\v2 Detailes Site Inspection\\.mergin\\fetch_v4-v6'

DuKangaroo avatar Jul 12 '21 21:07 DuKangaroo

Indeed, it is not a good idea to have Mergin projects stored within Dropbox folder, because the sync from Dropbox interferes with the sync in Mergin, causing problems like you got. Or try pausing Dropbox sync while you sync data with Mergin. Others have got similar errors (e.g. #266).

wonder-sk avatar Jul 13 '21 12:07 wonder-sk

I just starting experiencing this issue today with two of my projects that have been stored in OneDrive since April. I didn't realize this could cause problems and I have been syncing almost daily (sometimes pausing OneDrive syncing but not always). Something must have changed with Mergin this week I assume. The projects are just stored in OneDrive to increase redundancy of backups so I can move them into a regular folder).

The sync will not complete now even when I pause OneDrive syncing beforehand. I will move them out of OneDrive just to remove this variable from the equation.

rjwillson avatar Jul 16 '21 16:07 rjwillson

@rjwillson you are getting a different issue though, right? (The one reported in #279 ?) It could be that OneDrive is doing sync differently from Dropbox and the problem you are experiencing is due to the upgrade of the mergin plugin (2021.4), not due to OneDrive...

wonder-sk avatar Jul 21 '21 15:07 wonder-sk

yes, that's correct as I am still experiencing the issue (The one reported in #279) even with the project moved out of OneDrive. So OneDrive is not the culprit in my case.

rjwillson avatar Jul 21 '21 15:07 rjwillson

hi, i seem top have the same problem due to an unhandled exception:

here is the most recent log:

Traceback (most recent call last):

File "C:\Users/LattePanda/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\Mergin\mergin\merginproject.py", line 437, in apply_pull_changes self.geodiff.create_changeset(basefile, src, server_diff)

File "C:\Users/LattePanda/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\Mergin\mergin\deps\pygeodiff\main.py", line 65, in create_changeset return self.clib.create_changeset(base, modified, changeset)

File "C:\Users/LattePanda/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\Mergin\mergin\deps\pygeodiff\geodifflib.py", line 200, in create_changeset _parse_return_code(res, "createChangeset")

File "C:\Users/LattePanda/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\Mergin\mergin\deps\pygeodiff\geodifflib.py", line 41, in _parse_return_code raise GeoDiffLibError(msg)

zweers avatar Jul 25 '21 14:07 zweers

@zweers it looks like the problem you are experiencing is actually the one reported in #279

wonder-sk avatar Jul 27 '21 20:07 wonder-sk

Hi, I keep getting this problem when i try to sync my work, kindly help

Traceback (most recent call last):

File "C:/Users/NSP/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\Mergin\sync_dialog.py", line 222, in push_timer_tick push_project_finalize(self.job)

File "C:/Users/NSP/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\Mergin\mergin\client_push.py", line 276, in push_project_finalize job.mp.apply_push_changes(job.changes)

File "C:/Users/NSP/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\Mergin\mergin\merginproject.py", line 516, in apply_push_changes self.geodiff.make_copy_sqlite(self.fpath(path), basefile)

File "C:/Users/NSP/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\Mergin\mergin\deps\pygeodiff\main.py", line 221, in make_copy_sqlite return self.clib.make_copy_sqlite(src, dst)

File "C:/Users/NSP/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\Mergin\mergin\deps\pygeodiff\geodifflib.py", line 328, in make_copy_sqlite _parse_return_code(res, "make_copy_sqlite")

File "C:/Users/NSP/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\Mergin\mergin\deps\pygeodiff\geodifflib.py", line 41, in _parse_return_code raise GeoDiffLibError(msg)

Mergin.mergin.deps.pygeodiff.geodifflib.GeoDiffLibError: make_copy_sqlite

LAE-F avatar Aug 02 '21 11:08 LAE-F

@LAE-F what version of the Mergin plugin are you using? If it is 2021.4, then please upgrade to 2021.4.1 where the problem should be fixed already...

wonder-sk avatar Aug 02 '21 12:08 wonder-sk

I Just upgraded to 2021.4.1 , but i'm still getting the same problem please.

LAE-F avatar Aug 02 '21 12:08 LAE-F

@LAE-F could you please send the diagnostic log from the plugin? Please see https://help.cloudmergin.com/plugin-logs

Also, it would be useful if you could describe what you are doing before sync. Does it fail every time, or only sometimes?

wonder-sk avatar Aug 02 '21 13:08 wonder-sk

This is actually the first time it is failing to sync. I don't know if its because i'm using a GeoPackage Layer. Whenever i save my work as a shapefile, it syncs on the first try.

LAE-F avatar Aug 02 '21 13:08 LAE-F

But when using shapefiles, you do not get the automatic merging of changes from multiple devices, that is only supported for GeoPackages. Shapefiles are handled just like any other binary files (like pictures).

wonder-sk avatar Aug 02 '21 13:08 wonder-sk

Oh interesting. It has worked now, but some of the layers aren't showing on my other devices .

LAE-F avatar Aug 02 '21 16:08 LAE-F