You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import subprocess
from pathlib import Path
project_path = Path("./dummyproject")
script = (project_path / 'addone.sh')
subprocess.run([script, "42"]) # causes error only with debugger
subprocess.run([str(script), "42"]). # works in either case
❯ cd /Users/matt/src/tdid-proj ; /usr/bin/env /usr/bin/python3 /Users/matt/.vscode/extensions/ms-python.python-2021.4.765268190/pythonFiles/lib/python/debugpy/launcher 57883 -- /Users/matt/src/tdid-proj/dummyproject-test/fingerprints/bug.py ./dummyproject
Error patching args (debugger not attached to subprocess).
Traceback (most recent call last):
File "/Users/matt/.vscode/extensions/ms-python.python-2021.4.765268190/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydev_bundle/pydev_monkey.py", line 243, in patch_args
if not is_python(unquoted_args[0]):
File "/Users/matt/.vscode/extensions/ms-python.python-2021.4.765268190/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydev_bundle/pydev_monkey.py", line 152, in is_python
single_quote, double_quote = _get_str_type_compatible(path, ["'", '"'])
File "/Users/matt/.vscode/extensions/ms-python.python-2021.4.765268190/pythonFiles/lib/python/debugpy/_vendored/pydevd/_pydev_bundle/pydev_monkey.py", line 136, in _get_str_type_compatible
ret.append(arg.decode('utf-8'))
AttributeError: 'str' object has no attribute 'decode'
43
43
Steps to reproduce:
Pass a pathlib.Path object to subprocess.run. Notice that:
the debugger fails to attach to the subprocess (fine)
errors show up in the output that don't show up without the debugger (not fine)
Workaround
Cast the pathllib.Path object to a string first
Resoning
I never wanted to attach the debugger to the subprocess in the first place. I'm OK with the fact that it failed. But it should faill in a way that doesn't clutter up stdout and make me think my code is broken. Also, more useful errors would be nice.
Thank you.
The text was updated successfully, but these errors were encountered:
Environment data
Trouble Code
# addone.sh
Expected behaviour
run without debugging:
start debugging:
Actual behaviour
run without debugging:
start debugging:
Steps to reproduce:
Pass a pathlib.Path object to subprocess.run. Notice that:
Workaround
Cast the pathllib.Path object to a string first
Resoning
I never wanted to attach the debugger to the subprocess in the first place. I'm OK with the fact that it failed. But it should faill in a way that doesn't clutter up stdout and make me think my code is broken. Also, more useful errors would be nice.
Thank you.
The text was updated successfully, but these errors were encountered: