Skip to content

source code string cannot contain null bytes #1794

@gian-didom

Description

@gian-didom

Before creating a new issue, please check the FAQ to see if your question is answered there.

Environment data

  • debugpy version: 1.8.1
  • OS and version: MacOS Ventura
  • Python version (& distribution if applicable, e.g. Anaconda): Python 3.13.1 (main, Dec 3 2024, 17:59:52) [Clang 16.0.0 (clang-1600.0.26.4)] on darwin
  • Using VS Code or Visual Studio: VS Code

Actual behavior

Suddenly, when debugging worked just fine in VS Code, I now get an error while trying to start my application in debug mode.
The error I get is this:

source code string cannot contain null bytes

And happens in runpy.py when loading the code variable. The code.co_filename value is '.../.vscode/extensions/ms-python.debugpy-2024.8.0-darwin-arm64/bundled/libs/debugpy/adapter/../../debugpy/launcher/../../debugpy/__main__.py'

I tried the following:

  • Delete all pycache in project directory --> No result
  • Delete all pycache in debugpy folder --> No result
  • Delete and re-save the main.py found in debugpy folder --> No result
  • Change debugpy main.py to only print a message --> Message is printed if immediately before line 66 ( import debugpy # noqa)
  • Change my source code to a simple print("Hello world!") --> Issue persists
  • Reinstall debugpy from VS Code --> Issue persists
  • Uninstall debugpy and reinstall debugpy from VS Code --> Issue persists

Expected behavior

I'd expected the debugger to run just fine as it did this morning.

Steps to reproduce:

  1. Run debugging from VS Code with the following configuration:
{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Debugger Python: File corrente",
            "type": "debugpy",
            "request": "launch",
            "program": "${workspaceFolder}/.venv/bin/python3",
            "console": "integratedTerminal",
            "justMyCode": false
        }
    ]
}

Metadata

Metadata

Assignees

Labels

needs reproIssue has not been reproduced yet

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions