MerginMaps / qgis-plugin

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

Problem synchronising QGis project with Mergin after changing *.Mbtiles offline maps #188

Open BoswachterMarc opened 3 years ago

BoswachterMarc commented 3 years ago

Hi,

I am using almost every day a QGis project and sync happens almost every two days. Today I changed some *.mbtiles offline maps and I got this mismatch:

Mergin.mergin.common.ClientError: Error requesting https://public.cloudmergin.com/v1/project/Boswachter_Marc/MiradalCloudSurvey_201122?since=v69: Traceback (most recent call last): File "/usr/lib/python3.8/urllib/request.py", line 1350, in do_open h.request(req.get_method(), req.selector, req.data, headers, File "/usr/lib/python3.8/http/client.py", line 1255, in request self._send_request(method, url, body, headers, encode_chunked) File "/usr/lib/python3.8/http/client.py", line 1301, in _send_request self.endheaders(body, encode_chunked=encode_chunked) File "/usr/lib/python3.8/http/client.py", line 1250, in endheaders self._send_output(message_body, encode_chunked=encode_chunked) File "/usr/lib/python3.8/http/client.py", line 1010, in _send_output self.send(msg) File "/usr/lib/python3.8/http/client.py", line 950, in send self.connect() File "/usr/lib/python3.8/http/client.py", line 1417, in connect super().connect() File "/usr/lib/python3.8/http/client.py", line 921, in connect self.sock = self._create_connection( File "/usr/lib/python3.8/socket.py", line 787, in create_connection for res in getaddrinfo(host, port, 0, SOCK_STREAM): File "/usr/lib/python3.8/socket.py", line 918, in getaddrinfo for res in _socket.getaddrinfo(host, port, family, type, proto, flags): socket.gaierror: [Errno -2] Naam of dienst is niet bekend

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/boswachter/.local/share/QGIS/QGIS3/profiles/default/python/plugins/Mergin/mergin/client.py", line 131, in _do_request return self.opener.open(request) File "/usr/lib/python3.8/urllib/request.py", line 525, in open response = self._open(req, data) File "/usr/lib/python3.8/urllib/request.py", line 542, in _open result = self._call_chain(self.handle_open, protocol, protocol + 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 1393, in https_open return self.do_open(http.client.HTTPSConnection, req, File "/usr/lib/python3.8/urllib/request.py", line 1353, in do_open raise URLError(err) urllib.error.URLError:

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/home/boswachter/.local/share/QGIS/QGIS3/profiles/default/python/plugins/Mergin/plugin.py", line 319, in sync_project pull_changes, push_changes, push_changes_summary = self.mc.project_status(self.path) File "/home/boswachter/.local/share/QGIS/QGIS3/profiles/default/python/plugins/Mergin/mergin/client.py", line 449, in project_status server_info = self.project_info(project_path, since=local_version) File "/home/boswachter/.local/share/QGIS/QGIS3/profiles/default/python/plugins/Mergin/mergin/client.py", line 332, in project_info resp = self.get("/v1/project/{}".format(project_path), params) File "/home/boswachter/.local/share/QGIS/QGIS3/profiles/default/python/plugins/Mergin/mergin/client.py", line 146, in get return self._do_request(request) File "/home/boswachter/.local/share/QGIS/QGIS3/profiles/default/python/plugins/Mergin/mergin/client.py", line 114, in wrapper return f(self, *args) File "/home/boswachter/.local/share/QGIS/QGIS3/profiles/default/python/plugins/Mergin/mergin/client.py", line 139, in _do_request raise ClientError("Error requesting " + request.full_url + ": " + str(e)) Mergin.mergin.common.ClientError: Error requesting https://public.cloudmergin.com/v1/project/Boswachter_Marc/MiradalCloudSurvey_201122?since=v69:

Python versie: 3.8.5 (default, Jul 28 2020, 12:59:40) [GCC 9.3.0] QGIS versie: 3.16.0-Hannover Hannover, 43b64b13f3

Python pad: /usr/share/qgis/python /home/boswachter/.local/share/QGIS/QGIS3/profiles/default/python /home/boswachter/.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 /usr/local/lib/python3.8/dist-packages /usr/lib/python3/dist-packages /home/boswachter/.local/share/QGIS/QGIS3/profiles/default/python /home/boswachter/Geodata/Geopackages/MiradalCloudSurvey_201122

Could you have a look at the problem? Thank you. .

BoswachterMarc commented 3 years ago

And here are some more Python warnings I got

2020-12-13T15:16:14 WARNING warning:/usr/lib/python3/dist-packages/qgis/utils.py:792: DeprecationWarning: the imp module is deprecated in favour of importlib; see the module's documentation for alternative uses mod = _builtin_import(name, globals, locals, fromlist, level)

         traceback: File "", line 1, in 
          File "/usr/lib/python3/dist-packages/qgis/utils.py", line 302, in loadPlugin
          __import__(packageName)
          File "/usr/lib/python3/dist-packages/qgis/utils.py", line 792, in _import
          mod = _builtin_import(name, globals, locals, fromlist, level)
          File "", line 991, in _find_and_load
          File "", line 975, in _find_and_load_unlocked
          File "", line 671, in _load_unlocked
          File "", line 783, in exec_module
          File "", line 219, in _call_with_frames_removed
          File "/usr/share/qgis/python/plugins/processing/__init__.py", line 26, in 
          from processing.tools.general import * # NOQA
          File "/usr/lib/python3/dist-packages/qgis/utils.py", line 792, in _import
          mod = _builtin_import(name, globals, locals, fromlist, level)
          File "", line 991, in _find_and_load
          File "", line 975, in _find_and_load_unlocked
          File "", line 671, in _load_unlocked
          File "", line 783, in exec_module
          File "", line 219, in _call_with_frames_removed
          File "/usr/share/qgis/python/plugins/processing/tools/general.py", line 32, in 
          from processing.core.Processing import Processing
          File "/usr/lib/python3/dist-packages/qgis/utils.py", line 792, in _import
          mod = _builtin_import(name, globals, locals, fromlist, level)
          File "", line 991, in _find_and_load
          File "", line 975, in _find_and_load_unlocked
          File "", line 671, in _load_unlocked
          File "", line 783, in exec_module
          File "", line 219, in _call_with_frames_removed
          File "/usr/share/qgis/python/plugins/processing/core/Processing.py", line 56, in 
          from processing.algs.qgis.QgisAlgorithmProvider import QgisAlgorithmProvider # NOQA
          File "/usr/lib/python3/dist-packages/qgis/utils.py", line 792, in _import
          mod = _builtin_import(name, globals, locals, fromlist, level)
          File "", line 991, in _find_and_load
          File "", line 975, in _find_and_load_unlocked
          File "", line 671, in _load_unlocked
          File "", line 783, in exec_module
          File "", line 219, in _call_with_frames_removed
          File "/usr/share/qgis/python/plugins/processing/algs/qgis/QgisAlgorithmProvider.py", line 50, in 
          from .HypsometricCurves import HypsometricCurves
          File "/usr/lib/python3/dist-packages/qgis/utils.py", line 792, in _import
          mod = _builtin_import(name, globals, locals, fromlist, level)
          File "", line 991, in _find_and_load
          File "", line 975, in _find_and_load_unlocked
          File "", line 671, in _load_unlocked
          File "", line 783, in exec_module
          File "", line 219, in _call_with_frames_removed
          File "/usr/share/qgis/python/plugins/processing/algs/qgis/HypsometricCurves.py", line 27, in 
          from osgeo import gdal, ogr, osr
          File "/usr/lib/python3/dist-packages/qgis/utils.py", line 792, in _import
          mod = _builtin_import(name, globals, locals, fromlist, level)
          File "", line 991, in _find_and_load
          File "", line 975, in _find_and_load_unlocked
          File "", line 671, in _load_unlocked
          File "", line 783, in exec_module
          File "", line 219, in _call_with_frames_removed
          File "/usr/lib/python3/dist-packages/osgeo/__init__.py", line 41, in 
          _gdal = swig_import_helper()
          File "/usr/lib/python3/dist-packages/osgeo/__init__.py", line 15, in swig_import_helper
          import imp
          File "/usr/lib/python3/dist-packages/qgis/utils.py", line 792, in _import
          mod = _builtin_import(name, globals, locals, fromlist, level)
          File "", line 991, in _find_and_load
          File "", line 975, in _find_and_load_unlocked
          File "", line 671, in _load_unlocked
          File "", line 783, in exec_module
          File "", line 219, in _call_with_frames_removed
          File "/usr/lib/python3.8/imp.py", line 31, in 
          warnings.warn("the imp module is deprecated in favour of importlib; "

2020-12-13T15:16:34 WARNING warning:/home/boswachter/.local/share/QGIS/QGIS3/profiles/default/python/plugins/Mergin/sync_dialog.py:282: DeprecationWarning: an integer is required (got type float). Implicit conversion to integers using int is deprecated, and may be removed in a future version of Python. self.progress.setMaximum(self.job.total_size / 1024)

         traceback: File "/home/boswachter/.local/share/QGIS/QGIS3/profiles/default/python/plugins/Mergin/plugin.py", line 327, in sync_project
          dlg.exec_() # blocks until success, failure or cancellation
          File "/home/boswachter/.local/share/QGIS/QGIS3/profiles/default/python/plugins/Mergin/sync_dialog.py", line 282, in pull_start_internal
          self.progress.setMaximum(self.job.total_size / 1024)

2020-12-13T15:16:34 WARNING warning:/home/boswachter/.local/share/QGIS/QGIS3/profiles/default/python/plugins/Mergin/sync_dialog.py:291: DeprecationWarning: an integer is required (got type float). Implicit conversion to integers using int is deprecated, and may be removed in a future version of Python. self.progress.setValue(self.job.transferred_size / 1024)

         traceback: File "/home/boswachter/.local/share/QGIS/QGIS3/profiles/default/python/plugins/Mergin/plugin.py", line 327, in sync_project
          dlg.exec_() # blocks until success, failure or cancellation
          File "/home/boswachter/.local/share/QGIS/QGIS3/profiles/default/python/plugins/Mergin/sync_dialog.py", line 51, in timer_timeout
          self.pull_timer_tick()
          File "/home/boswachter/.local/share/QGIS/QGIS3/profiles/default/python/plugins/Mergin/sync_dialog.py", line 291, in pull_timer_tick
          self.progress.setValue(self.job.transferred_size / 1024)
BoswachterMarc commented 3 years ago

The project sync says 'unhandled exception'. About the TopokaartBrabantseWouden_ZL17.mbtiles > it is not part of the project but was a offline map in the project folder on my computer. Printscreen2

Traceback (most recent call last):

File "/home/boswachter/.local/share/QGIS/QGIS3/profiles/default/python/plugins/Mergin/sync_dialog.py", line 310, in pull_timer_tick self.pull_conflicts = pull_project_finalize(self.job)

File "/home/boswachter/.local/share/QGIS/QGIS3/profiles/default/python/plugins/Mergin/mergin/client_pull.py", line 523, in pull_project_finalize conflicts = job.mp.apply_pull_changes(job.pull_changes, job.temp_dir)

File "/home/boswachter/.local/share/QGIS/QGIS3/profiles/default/python/plugins/Mergin/mergin/merginproject.py", line 462, in apply_pull_changes os.remove(dest)

FileNotFoundError: [Errno 2] Bestand of map bestaat niet: '/home/boswachter/Geodata/Geopackages/MiradalCloudSurvey_201122/TopokaartBrabantseWouden_ZL17.mbtiles'

wonder-sk commented 3 years ago

Hi Marc

There seem to be two different errors:

The warnings are mostly unrelated (coming from processing toolbox) but there are two related to mergin, which I have move to a separate ticket - https://github.com/lutraconsulting/mergin-py-client/issues/88

In case you can't replicate that "ClientError" anymore, I would suggest that we close this ticket...