MerginMaps / MerginMaps/qgis-plugin
Python error on sync when project was deleted
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 44
- Forks
- 20
- Avg merge
- 3d 12h
- Merged PRs (30d)
- 5
Description
Steps:
1) open an project of an organization in QGIS
2) remove the organization in mergin (and all the projects with it)
3) press synchronize - there is a crash
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/shockwave/.local/share/QGIS/QGIS3/profiles/default/python/plugins/Mergin/mergin/client.py", line 186, 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/shockwave/.local/share/QGIS/QGIS3/profiles/default/python/plugins/Mergin/plugin.py", line 262, in current_project_sync
self.manager.sync_project(self.mergin_proj_dir)
File "/home/shockwave/.local/share/QGIS/QGIS3/profiles/default/python/plugins/Mergin/projects_manager.py", line 208, in sync_project
pull_changes, push_changes, push_changes_summary = self.mc.project_status(project_dir)
File "/home/shockwave/.local/share/QGIS/QGIS3/profiles/default/python/plugins/Mergin/mergin/client.py", line 590, in project_status
server_info = self.project_info(project_path, since=local_version)
File "/home/shockwave/.local/share/QGIS/QGIS3/profiles/default/python/plugins/Mergin/mergin/client.py", line 450, in project_info
resp = self.get("/v1/project/{}".format(project_path), params)
File "/home/shockwave/.local/share/QGIS/QGIS3/profiles/default/python/plugins/Mergin/mergin/client.py", line 201, in get
return self._do_request(request)
File "/home/shockwave/.local/share/QGIS/QGIS3/profiles/default/python/plugins/Mergin/mergin/client.py", line 176, in wrapper
return f(self, *args)
File "/home/shockwave/.local/share/QGIS/QGIS3/profiles/default/python/plugins/Mergin/mergin/client.py", line 190, 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, Jun 2 2021, 10:49:15) [GCC 9.4.0]
QGIS version: 3.16.9-Hannover Hannover, 9f8d2f7942
Python Path:
/usr/share/qgis/python
/home/shockwave/.local/share/QGIS/QGIS3/profiles/default/python
/home/shockwave/.local/share/QGIS/QGIS3/profiles/default/python/plugins
/usr/share/qgis/python/plugins
/usr/lib/python38.zip
/usr/lib/python3.8
/usr/lib/python3.8/lib-dynload
/home/shockwave/.local/lib/python3.8/site-packages
/usr/local/lib/python3.8/dist-packages
/usr/lib/python3/dist-packages
/home/shockwave/.local/share/QGIS/QGIS3/profiles/default/python
.
/home/shockwave/Lutra/projects/test_mergin/11.8./org1_project2
```
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the traceback path through mergin/client.py, especially _do_request and project_info, then follow the call from projects_manager.py sync_project to plugin.py current_project_sync. Reproduce synchronization after the project is deleted and define handling for the 404 so synchronization no longer crashes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100