MerginMaps / qgis-plugin

QGIS plugin for managing Mergin Maps projects
GNU General Public License v3.0
34 stars 13 forks source link

Plugin crash after project was removed from mergin #366

Open jozef-budac opened 2 years ago

jozef-budac commented 2 years ago

When I opened project in QGIS, then removed it from mergin server and then hit synchronize in mergin plugin, it crashes with this stacktrace:


An error has occurred while executing Python code: 

Mergin.mergin.common.ClientError: The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again. 
Traceback (most recent call last):
  File "/home/jozef/.local/share/QGIS/QGIS3/profiles/15.3.22/python/plugins/Mergin/mergin/client.py", line 188, in _do_request
    return self.opener.open(request)
  File "/usr/lib/python3.8/urllib/request.py", line 531, in open
    response = meth(req, response)
  File "/usr/lib/python3.8/urllib/request.py", line 640, in http_response
    response = self.parent.error(
  File "/usr/lib/python3.8/urllib/request.py", line 569, in error
    return self._call_chain(*args)
  File "/usr/lib/python3.8/urllib/request.py", line 502, in _call_chain
    result = func(*args)
  File "/usr/lib/python3.8/urllib/request.py", line 649, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 404: NOT FOUND

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/jozef/.local/share/QGIS/QGIS3/profiles/15.3.22/python/plugins/Mergin/plugin.py", line 300, in current_project_sync
    self.manager.sync_project(self.mergin_proj_dir)
  File "/home/jozef/.local/share/QGIS/QGIS3/profiles/15.3.22/python/plugins/Mergin/projects_manager.py", line 225, in sync_project
    pull_changes, push_changes, push_changes_summary = self.mc.project_status(project_dir)
  File "/home/jozef/.local/share/QGIS/QGIS3/profiles/15.3.22/python/plugins/Mergin/mergin/client.py", line 704, in project_status
    server_info = self.project_info(project_path, since=local_version)
  File "/home/jozef/.local/share/QGIS/QGIS3/profiles/15.3.22/python/plugins/Mergin/mergin/client.py", line 474, in project_info
    resp = self.get("/v1/project/{}".format(project_path), params)
  File "/home/jozef/.local/share/QGIS/QGIS3/profiles/15.3.22/python/plugins/Mergin/mergin/client.py", line 203, in get
    return self._do_request(request)
  File "/home/jozef/.local/share/QGIS/QGIS3/profiles/15.3.22/python/plugins/Mergin/mergin/client.py", line 178, in wrapper
    return f(self, *args)
  File "/home/jozef/.local/share/QGIS/QGIS3/profiles/15.3.22/python/plugins/Mergin/mergin/client.py", line 192, in _do_request
    raise ClientError(info.get("detail"))
Mergin.mergin.common.ClientError: The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.

Python version: 3.8.10 (default, Nov 26 2021, 20:14:08) [GCC 9.3.0] 
QGIS version: 3.22.5-Białowieża Białowieża, c27231782f 

Python Path:
/usr/share/qgis/python
/home/jozef/.local/share/QGIS/QGIS3/profiles/15.3.22/python
/home/jozef/.local/share/QGIS/QGIS3/profiles/15.3.22/python/plugins
/usr/share/qgis/python/plugins
/usr/lib/python38.zip
/usr/lib/python3.8
/usr/lib/python3.8/lib-dynload
/home/jozef/.local/lib/python3.8/site-packages
/usr/local/lib/python3.8/dist-packages
/usr/lib/python3/dist-packages
/home/jozef/.local/share/QGIS/QGIS3/profiles/15.3.22/python
.
/home/jozef/Lutra/projects/21.3.22/Sync_issue
wonder-sk commented 2 years ago

Duplicate of #283?