Environment data
- debugpy version: 1.8.13
- OS and version: Ubuntu 24.04
- Python version (& distribution if applicable, e.g. Anaconda): 3.12
- Using VS Code or Visual Studio: VS Code
Actual behavior
Using joblib (1.5.1) debugpy prints
Traceback (most recent call last):
File "/root/.vscode-server/extensions/ms-python.debugpy-2025.9.2025052001/bundled/libs/debugpy/_vendored/pydevd/_pydev_bundle/pydev_monkey.py", line 543, in patch_args
new_args.append(_get_python_c_args(host, port, code, unquoted_args, SetupHolder.setup))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/root/.vscode-server/extensions/ms-python.debugpy-2025.9.2025052001/bundled/libs/debugpy/_vendored/pydevd/_pydev_bundle/pydev_monkey.py", line 195, in _get_python_c_args
if "__future__" in code:
^^^^^^^^^^^^^^^^^^^^
TypeError: a bytes-like object is required, not 'str'
Expected behavior
Checking if code is byte
Steps to reproduce:
launch.json
{
"version": "0.2.0",
"configurations": [
{
"name": "Worker",
"type": "debugpy",
"request": "launch",
"module": "app.worker",
"subProcess": true, // with this to false we wont debug the subprocess
"justMyCode": true
}
]
}
app/worker.py
from joblib import Parallel, delayed
def test():
return 42
Parallel(n_jobs=10)(delayed(test)() for _ in range(10))
Tested monkey patch:
@@ -190,7 +190,8 @@
setup_repr = setup if setup is None else (sorted_dict_repr(setup))
future_imports = ""
- if "__future__" in code:
+ future_str = b'__future__' if isinstance(code, bytes) else '__future__'
+ if future_str in code:
# If the code has a __future__ import, we need to be able to strip the __future__
# imports from the code and add them to the start of our code snippet.
future_imports, code = _separate_future_imports(code)
But with this I receive a deadlock
/tmp/venv/lib/python3.12/site-packages/joblib/externals/loky/backend/resource_tracker.py:120: UserWarning: resource_tracker: process died unexpectedly, relaunching. Some folders/sempahores might leak.
warnings.warn(
Environment data
Actual behavior
Using
joblib(1.5.1) debugpy printsExpected behavior
Checking if code is byte
Steps to reproduce:
launch.json
{ "version": "0.2.0", "configurations": [ { "name": "Worker", "type": "debugpy", "request": "launch", "module": "app.worker", "subProcess": true, // with this to false we wont debug the subprocess "justMyCode": true } ] }app/worker.py
Tested monkey patch:
But with this I receive a deadlock