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

[Bug] Loading env variables with trailing comments #24720

Closed
HKozubek opened this issue Jan 10, 2025 · 0 comments
Closed

[Bug] Loading env variables with trailing comments #24720

HKozubek opened this issue Jan 10, 2025 · 0 comments
Labels
triage-needed Needs assignment to the proper sub-team

Comments

@HKozubek
Copy link

Describe the bug
The debugger loads trailing comments when loading env variables form .env file

To Reproduce
Create .env file and test.py file

# .env
TEST_VAR = test # This comment will show up
# test.py
import os
from dotenv import load_dotenv

load_dotenv()
print(os.getenv("TEST_VAR"))
# python prints 'test'
# debugger prints 'test # This comment will show up'

Run the file, once with python, once using debugger

python -m venv venv && source venv/bin/activate && pip install python-dotenv
python test.py

when running with python the output looks like this:

test

when running with debugger the output looks like this:

test # This comment will show up

Expected behavior
The comment from .env file shouldn't be read as a part of variable when using the debugger

Environment:

  • OS: Ubuntu 22.04
  • Python: 3.12.2
  • Extension version: 2024.15.2024121701
@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Jan 10, 2025
@eleanorjboyd eleanorjboyd transferred this issue from microsoft/vscode-python-debugger Jan 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage-needed Needs assignment to the proper sub-team
Projects
None yet
Development

No branches or pull requests

2 participants