Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

source code string cannot contain null bytes #1794

Closed
gian-didom opened this issue Jan 1, 2025 · 1 comment
Closed

source code string cannot contain null bytes #1794

gian-didom opened this issue Jan 1, 2025 · 1 comment
Assignees
Labels
needs repro Issue has not been reproduced yet

Comments

@gian-didom
Copy link

gian-didom commented Jan 1, 2025

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
        }
    ]
}

@github-actions github-actions bot added the needs repro Issue has not been reproduced yet label Jan 1, 2025
@gian-didom
Copy link
Author

Closing because the "program" field was uncorrectly set to the .venv interpreter instead of the .py file, causing the python to load binary code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs repro Issue has not been reproduced yet
Projects
None yet
Development

No branches or pull requests

2 participants