inducer / pudb

Full-screen console debugger for Python
https://documen.tician.de/pudb/
Other
2.99k stars 229 forks source link

tty terminal - UnicodeDecodeError: 'utf-8' codec can't decode byte (pudb/debugger.py in _runscript) #565

Closed bobslee closed 2 years ago

bobslee commented 2 years ago

Describe the bug When debugging from a separate terminal, upon starting the debugger the following error (and traceback) occurs.

Traceback error

Traceback (most recent call last):
  File "/nix/store/hsb32260j4qr5dwwwkw1fcr9bcizf428-python3.8-pudb-2022.1.1/lib/python3.8/site-packages/pudb/__init__.py", line 148, in runscript
    dbg._runscript(mainpyfile)
  File "/nix/store/hsb32260j4qr5dwwwkw1fcr9bcizf428-python3.8-pudb-2022.1.1/lib/python3.8/site-packages/pudb/debugger.py", line 514, in _runscript
    self.run(statement)
  File "/nix/store/2fhkgfzpn8g18vinwafzxlz89pqrg0x2-python3-3.8.13/lib/python3.8/bdb.py", line 580, in run
    exec(cmd, globals, locals)
  File "<string>", line 1, in <module>
  File "/nix/store/2fhkgfzpn8g18vinwafzxlz89pqrg0x2-python3-3.8.13/lib/python3.8/codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x88 in position 40: invalid start byte

To Reproduce Steps to reproduce the behavior:

  1. CLI: PUDB_TTY=/dev/pts/0 pudb3 .venv/bin/python ./my-script.py
  2. See error and traceback above

Expected behavior A debugger without the error.

Screenshot image

Versions

inducer commented 2 years ago

PUDB_TTY=/dev/pts/0 pudb3 .venv/bin/python ./my-script.py

What's that .venv/bin/python doing there? Pudb will try to read that like a script.

asmeurer commented 2 years ago

If you want to run pudb from a specific python, you should use ./venv/bin/python -m pudb my_script.py.

bobslee commented 2 years ago

Ok thanks!