UnicodeDecodeError: 'utf-8' codec can't decode byte 0xbc in position 4097: invalid start byte upon startup

Issue #92 new
Kevin created an issue

I’m using the python-can library and when I start my script if I have my CAN network up I get the following error. If I don’t have my CAN interface up before I start the script then bring it up it works fine. Thoughts?

pipenv run python3 dataaq.py
Traceback (most recent call last):
  File "dataaq.py", line 2, in <module>
    import can
  File "/home/pi/.local/share/virtualenvs/dataaq-RtJwUZ71/lib/python3.7/site-packages/can/__init__.py", line 31, in <module>
    from .io import Logger, Printer, LogReader, MessageSync
  File "/home/pi/.local/share/virtualenvs/dataaq-RtJwUZ71/lib/python3.7/site-packages/can/io/__init__.py", line 11, in <module>
    from .logger import Logger
  File "/home/pi/.local/share/virtualenvs/dataaq-RtJwUZ71/lib/python3.7/site-packages/can/io/logger.py", line 13, in <module>
    from .asc import ASCWriter
  File "/home/pi/.local/share/virtualenvs/dataaq-RtJwUZ71/lib/python3.7/site-packages/can/io/asc.py", line 19, in <module>
    from ..util import channel2int
  File "/home/pi/.local/share/virtualenvs/dataaq-RtJwUZ71/lib/python3.7/site-packages/can/util.py", line 23, in <module>
    from can.interfaces import VALID_INTERFACES
  File "/home/pi/.local/share/virtualenvs/dataaq-RtJwUZ71/lib/python3.7/site-packages/can/interfaces/__init__.py", line 8, in <module>
    from pkg_resources import iter_entry_points
  File "/home/pi/.local/share/virtualenvs/dataaq-RtJwUZ71/lib/python3.7/site-packages/pkg_resources/__init__.py", line 84, in <module>
    __import__('pkg_resources.extern.packaging.requirements')
  File "/home/pi/.local/share/virtualenvs/dataaq-RtJwUZ71/lib/python3.7/site-packages/pkg_resources/_vendor/packaging/requirements.py", line 9, in <module>
    from pkg_resources.extern.pyparsing import stringStart, stringEnd, originalTextFor, ParseException
  File "<frozen importlib._bootstrap>", line 983, in _find_and_load
  File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 668, in _load_unlocked
  File "<frozen importlib._bootstrap>", line 638, in _load_backward_compatible
  File "/home/pi/.local/share/virtualenvs/dataaq-RtJwUZ71/lib/python3.7/site-packages/pkg_resources/extern/__init__.py", line 43, in load_module
    __import__(extant)
  File "/home/pi/.local/share/virtualenvs/dataaq-RtJwUZ71/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 4756, in <module>
  File "/home/pi/.local/share/virtualenvs/dataaq-RtJwUZ71/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1284, in setParseAction
    self.parseAction = list(map(_trim_arity, list(fns)))
  File "/home/pi/.local/share/virtualenvs/dataaq-RtJwUZ71/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1066, in _trim_arity
    this_line = extract_stack(limit=2)[-1]
  File "/home/pi/.local/share/virtualenvs/dataaq-RtJwUZ71/lib/python3.7/site-packages/pkg_resources/_vendor/pyparsing.py", line 1050, in extract_stack
    frame_summary = traceback.extract_stack(limit=-offset+limit-1)[offset]
  File "/usr/lib/python3.7/traceback.py", line 211, in extract_stack
    stack = StackSummary.extract(walk_stack(f), limit=limit)
  File "/usr/lib/python3.7/traceback.py", line 363, in extract
    f.line
  File "/usr/lib/python3.7/traceback.py", line 285, in line
    self._line = linecache.getline(self.filename, self.lineno).strip()
  File "/usr/lib/python3.7/linecache.py", line 16, in getline
    lines = getlines(filename, module_globals)
  File "/usr/lib/python3.7/linecache.py", line 47, in getlines
    return updatecache(filename, module_globals)
  File "/usr/lib/python3.7/linecache.py", line 137, in updatecache
    lines = fp.readlines()
  File "/usr/lib/python3.7/codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xbc in position 4097: invalid start byte

Comments (1)

  1. Log in to comment