Skip to content

Unable to get full environment variable spread on multi line #850

Closed

Description

Description

Using envFile in launch.json file to load env variables from .env file does not load full variable which have multi line.

Environment Information

  • Python Debugger extension versions 2025.14.1

Example code

import os 

variable = os.getenv("EXAMPLE_VAR")
print("EXAMPLE_VAR:", variable)

launch.json

{
    "version": "0.2.0",
    "configurations": [

        {
            "name": "Python: Debug single file",
            "request": "launch",
            "type": "debugpy",
            "program": "${file}",
            "console": "integratedTerminal",
            "envFile": "${workspaceFolder}/example.env"
        }
    ]
}

example.env

EXAMPLE_VAR='very long value
with new line , we need to get all the lines'

Output

EXAMPLE_VAR: 'very long value

Expected output

EXAMPLE_VAR: very long value
with new line , we need to get all the lines

Using load_dotenv to load .env work as expected

import os 
from dotenv import load_dotenv

load_dotenv(dotenv_path="example.env")
variable = os.getenv("EXAMPLE_VAR")
print("EXAMPLE_VAR:", variable)

## Output
EXAMPLE_VAR: very long value
with new line , we need to get all the lines

Result with env load from launch.json

Image

Result with env load from load_dotenv

Image

Activity

  1. eleanorjboyd commented on Oct 29, 2025

    @eleanorjboyd
    Contributor

    is this with or without the python environments extension installed? Can you try disabling it and see if that makes a difference

  2. vuthanhdatt commented on Oct 31, 2025

    @vuthanhdatt
    Author

    disable python environments extension still facing same error

    Image
  3. github-actions commented on Nov 30, 2025

    @github-actions

    Hey Eleanor Boyd (@eleanorjboyd), this issue might need further attention.

    vuthanhdat (@vuthanhdatt), you can help us out by closing this issue if the problem no longer exists, or adding more information.

  4. github-actions commented on Dec 30, 2025

    @github-actions

    Because we have not heard back with the information we requested, we are closing this issue for now. If you are able to provide the info later on, then we will be happy to re-open this issue to pick up where we left off.

    Happy Coding!

  5. ShadowLNC commented on Jan 14, 2026

    @ShadowLNC

    I just hit this issue and assumed something was wrong with my environment, but no, it's the VS Code debugger not parsing the environment variable. I disabled the Python Environments extension, but it didn't help.

    I've don't have issues with multiline environment variables in other contexts (uv, docker compose, nodemon, dotenv, etc.), so I'm confused as to whether VSCode is using an existing library or rolling their own parser?

    Unclear if related to microsoft/vscode-python#18307

  6. github-actions commented on Feb 14, 2026

    @github-actions

    Hey Rich Chiodo (@rchiodo) Eleanor Boyd (@eleanorjboyd) @Copilot, this issue might need further attention.

    vuthanhdat (@vuthanhdatt), you can help us out by closing this issue if the problem no longer exists, or adding more information.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

info-neededIssue requires more information from postertriage-neededNeeds assignment to the proper sub-team

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions