profile
viewpoint

Ask questionsLookupError: unknown error handler name 'surrogateescape' when trying to debug PY 2 in VS

Environment data

  • debugpy version: 1.0.0b1 ( 7a2891b95054f132435585f6ab5dedf66be4f5ab )
  • OS and version: Windows 10 1903 ( build 18362.836 )
  • Python version: Python v2.7.17:c2f86d86e6
  • Using VS Code or Visual Studio: Microsoft Visual Studio Community 2019, Version 16.5.4

Actual behavior

I have a suite of python scripts. They run fine in visual studio when not debugging. However, when debugging python through visual studio, I get this error:

Exception in thread stdout:
Traceback (most recent call last):
  File "C:\Python27\lib\threading.py", line 801, in __bootstrap_inner
    self.run()
  File "C:\Python27\lib\threading.py", line 754, in run
    self.__target(*self.__args, **self.__kwargs)
  File "c:\program files (x86)\microsoft visual studio\2019\community\common7\ide\extensions\microsoft\python\core\debugpy\launcher/../../debugpy\launcher\output.py", line 62, in _worker
    self._process_chunk(s)
  File "c:\program files (x86)\microsoft visual studio\2019\community\common7\ide\extensions\microsoft\python\core\debugpy\launcher/../../debugpy\launcher\output.py", line 82, in _process_chunk
    s, _ = self._encode(s, "surrogateescape")
  File "C:\Python27\lib\encodings\cp437.py", line 12, in encode
    return codecs.charmap_encode(input,errors,encoding_map)
LookupError: unknown error handler name 'surrogateescape'

Expected behavior

I can debug Python 2 code without errors.

Steps to reproduce:

  1. Run a python 2 VS project
  2. Write out to a file
  3. Experience this error.
microsoft/debugpy

Answer questions cowlinator

Yes, the code runs successfully and prints ('foo', 3).

After taking a closer look, I see that a library I'm using is using Cython/pyximport. Could that have something to do with it?

useful!
source:https://uonfu.com/
Github User Rank List