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

Unicode decode error #32

Open
antoine56100 opened this issue Jul 9, 2022 · 1 comment
Open

Unicode decode error #32

antoine56100 opened this issue Jul 9, 2022 · 1 comment

Comments

@antoine56100
Copy link

Hi kawasaki,
I'm having trouble trying to link my EV3 to Scratch in Firefox on my Ubuntu desktop. Everything works fine but running scan the terminal indicates the following error

antoine@aldebaran:~$ scratch_link
2022-07-09 15:52:49,216 Certificate is ready in FireFox NSS DB: /home/antoine/.mozilla/firefox/weuf2nuw.default
2022-07-09 15:52:49,222 Certificate is ready in FireFox NSS DB: /home/antoine/.mozilla/firefox/weuf2nuw.default
2022-07-09 15:52:49,323 Certificate is ready for Chrome
2022-07-09 15:52:49,345 Started scratch-link
2022-07-09 15:52:57,703 Start session for web socket path: /scratch/bt
Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib/python3.10/threading.py", line 1009, in _bootstrap_inner
self.run()
File "/home/antoine/.local/lib/python3.10/site-packages/pyscrlink/scratch_link.py", line 212, in run
self.discover()
File "/home/antoine/.local/lib/python3.10/site-packages/pyscrlink/scratch_link.py", line 189, in discover
discoverer.find_devices(lookup_names=True)
File "/home/antoine/.local/lib/python3.10/site-packages/bluetooth/bluez.py", line 434, in find_devices
_bt.hci_filter_all_events (flt)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xff in position 4: invalid start byte

Any idea ?
Best regards,
Antoine

@kawasaki
Copy link
Owner

@antoine56100 Thanks for the report. Unfortunately, this issue looks difficult to resolve. It means that pyscrlink is not working for EV3 now. The error was reported by pybluez, but it is not well maintained (I don't have much time to maintain pyscrlink recently, either). Certain amount of issues are reported for pybluez but they are not resolved.

Maybe pyscrlink should stop relying on pybluez. I'm not sure if I can allocate my time to purge pybluez from pyscrlink and switch to other newer bluetooth python library.

As a memorandom, here I note what I observed.
I tried Bluetooth device search on my system, and I observed similar, but different error.

$ scratch_link
2022-07-16 12:00:22,270 Certificate is ready in FireFox NSS DB: /home/shin/.mozilla/firefox/nnysaloj.default
2022-07-16 12:00:22,739 Certificate is ready in FireFox NSS DB: /home/shin/.mozilla/firefox/nnysaloj.default/chrome_debugger_profile
2022-07-16 12:00:22,759 Certificate is ready for Chrome
2022-07-16 12:00:22,803 Started scratch-link
2022-07-16 12:02:55,435 Start session for web socket path: /scratch/bt
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
    self.run()
  File "/home/shin/.local/lib/python3.10/site-packages/pyscrlink/scratch_link.py", line 212, in run
    self.discover()
  File "/home/shin/.local/lib/python3.10/site-packages/pyscrlink/scratch_link.py", line 189, in discover
    discoverer.find_devices(lookup_names=True)
  File "/usr/lib/python3.10/site-packages/bluetooth/bluez.py", line 433, in find_devices
    flt = _bt.hci_filter_new ()
SystemError: PY_SSIZE_T_CLEAN macro must be defined for '#' formats

I also tried to install pybluez again, but failed to install pybluez from pip.

$ sudo pip install pybluez
Collecting pybluez
  Using cached PyBluez-0.23.tar.gz (97 kB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error
  
  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [1 lines of output]
      error in PyBluez setup command: use_2to3 is invalid.
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

This means that, pyscrlink really needs fixes.

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

No branches or pull requests

2 participants