envirosolutionspl / pobieracz_danych_gugik

Wtyczka QGIS do pobierania danych przestrzennych z zasobów GUGiK
GNU General Public License v3.0
5 stars 1 forks source link

Poprawa wtyczki w przypadku niepełnych pobrań #136

Open wojtek19022 opened 1 week ago

wojtek19022 commented 1 week ago

W przypadku słabego łącza wtyczka potrafi wyrzucić błąd python'a. Przy dobrym łączu nie ma takiego problemu. Błąd generowany podczas tego etapu wygląda następująco:


2024-06-21T14:23:46     WARNING    Wystąpił błąd podczas wykonywania kodu Pythona:

             requests.exceptions.ChunkedEncodingError: ('Connection broken: IncompleteRead(758533327 bytes read, 166649469 more expected)', IncompleteRead(758533327 bytes read, 166649469 more expected))

             Traceback (most recent call last):
             File "D:\QGIS_3_34\apps\Python312\Lib\site-packages\urllib3\response.py", line 737, in _error_catcher
             yield
             File "D:\QGIS_3_34\apps\Python312\Lib\site-packages\urllib3\response.py", line 883, in _raw_read
             raise IncompleteRead(self._fp_bytes_read, self.length_remaining)
             urllib3.exceptions.IncompleteRead: IncompleteRead(758533327 bytes read, 166649469 more expected)

             The above exception was the direct cause of the following exception:

             Traceback (most recent call last):
             File "D:\QGIS_3_34\apps\Python312\Lib\site-packages\requests\models.py", line 816, in generate
             yield from self.raw.stream(chunk_size, decode_content=True)
             File "D:\QGIS_3_34\apps\Python312\Lib\site-packages\urllib3\response.py", line 1043, in stream
             data = self.read(amt=amt, decode_content=decode_content)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
             File "D:\QGIS_3_34\apps\Python312\Lib\site-packages\urllib3\response.py", line 963, in read
             data = self._raw_read(amt)
             ^^^^^^^^^^^^^^^^^^^
             File "D:\QGIS_3_34\apps\Python312\Lib\site-packages\urllib3\response.py", line 861, in _raw_read
             with self._error_catcher():
             File "D:\QGIS_3_34\apps\Python312\Lib\contextlib.py", line 158, in __exit__
             self.gen.throw(value)
             File "D:\QGIS_3_34\apps\Python312\Lib\site-packages\urllib3\response.py", line 761, in _error_catcher
             raise ProtocolError(arg, e) from e
             urllib3.exceptions.ProtocolError: ('Connection broken: IncompleteRead(758533327 bytes read, 166649469 more expected)', IncompleteRead(758533327 bytes read, 166649469 more expected))

             During handling of the above exception, another exception occurred:

             Traceback (most recent call last):
             File "C:\Users/wojta/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\pobieracz_danych_gugik\tasks\downloadTrees3dTask.py", line 25, in run
             with get_legacy_session().get(url=trees_url, verify=False) as resp:
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
             File "D:\QGIS_3_34\apps\Python312\Lib\site-packages\requests\sessions.py", line 602, in get
             return self.request("GET", url, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
             File "D:\QGIS_3_34\apps\Python312\Lib\site-packages\requests\sessions.py", line 589, in request
             resp = self.send(prep, **send_kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
             File "D:\QGIS_3_34\apps\Python312\Lib\site-packages\requests\sessions.py", line 747, in send
             r.content
             File "D:\QGIS_3_34\apps\Python312\Lib\site-packages\requests\models.py", line 899, in content
             self._content = b"".join(self.iter_content(CONTENT_CHUNK_SIZE)) or b""
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
             File "D:\QGIS_3_34\apps\Python312\Lib\site-packages\requests\models.py", line 818, in generate
             raise ChunkedEncodingError(e)
             requests.exceptions.ChunkedEncodingError: ('Connection broken: IncompleteRead(758533327 bytes read, 166649469 more expected)', IncompleteRead(758533327 bytes read, 166649469 more expected))

             Wersja Pythona: 3.12.3 (main, Apr 14 2024, 17:21:43) [MSC v.1938 64 bit (AMD64)]

             Wersja QGIS: 3.34.6-Prizren Prizren, 623828f5

             Lokalizacja Pythona:

             D:/QGIS_3_34/apps/qgis-ltr/./pythonC:/Users/wojta/AppData/Roaming/QGIS/QGIS3\profiles\default/pythonC:/Users/wojta/AppData/Roaming/QGIS/QGIS3\profiles\default/python/pluginsD:/QGIS_3_34/apps/qgis-ltr/./python/pluginsD:\QGIS_3_34\apps\grass\grass83\etc\pythonC:\Users\wojta\DocumentsD:\QGIS_3_34\bin\python312.zipD:\QGIS_3_34\apps\Python312\DLLsD:\QGIS_3_34\apps\Python312\LibD:\QGIS_3_34\binD:\QGIS_3_34\apps\Python312D:\QGIS_3_34\apps\Python312\Lib\site-packagesD:\QGIS_3_34\apps\Python312\Lib\site-packages\win32D:\QGIS_3_34\apps\Python312\Lib\site-packages\win32\libD:\QGIS_3_34\apps\Python312\Lib\site-packages\PythonwinC:/Users/wojta/AppData/Roaming/QGIS/QGIS3\profiles\default/python.
wojtek19022 commented 1 week ago

Planowane w wersji Pobieracz 1.2.2