Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

An attempt at working around kart message encoding issues #318

Closed
wants to merge 1 commit into from

Conversation

hamishcampbell
Copy link
Member

@hamishcampbell hamishcampbell commented Dec 10, 2024

In some situations Kart is emitting messages that cannot be decoded as UTF-8.

File "C:\Users/xxxxxxx/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\koordinates\core\kart_task.py", line 106, in on_stdout
  self.on_stdout(ba)
  ^^^^^^^^^^^^^^
  File "C:\Users/xxxxxxx/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\koordinates\core\kart_task.py", line 106, in on_stdout
  self.on_stdout(ba)
  ^^^^^^^^^^^^^^
  File "C:\Users/xxxxxxx/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\koordinates\core\kart_task.py", line 106, in on_stdout
  self.on_stdout(ba)
  ^^^^^^^^^^^^^^
  [Previous line repeated 5 more times]
  File "C:\Users/xxxxxxx/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\koordinates\core\kart_task.py", line 185, in on_stdout
  val = ba.data().decode('UTF-8')
  ^^^^^^^^^^^^^^^^^^^^^^^^^
 UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe9 in position 117: invalid continuation byte
 
 The above exception was the direct cause of the following exception:
 
 SystemError: returned a result with an exception set
 
 The above exception was the direct cause of the following exception:
 
 SystemError: returned a result with an exception set
 
 The above exception was the direct cause of the following exception:
 
 Traceback (most recent call last):
  File "C:\Users/xxxxxxx/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\koordinates\core\kart_task.py", line 211, in run
  res = super().run()
  ^^^^^^^^^^^^^
  File "C:\Users/xxxxxxx/AppData/Roaming/QGIS/QGIS3\profiles\default/python/plugins\koordinates\core\kart_task.py", line 113, in run
  res = process.run(self._feedback)
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^
 SystemError: returned a result with an exception set

We're yet to understand the exact source of the message and haven't been able to reproduce outside of a particular environment, however this change attempts to harden the decode of the CLI response.

Copy link

Plugin ready!

A test version of this PR is available for testing here.

(Built from commit e2c3ecb)

@hamishcampbell
Copy link
Member Author

Superceded by #319

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant