Skip to content

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

@vuthanhdatt

Description

@vuthanhdatt

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

Metadata

Metadata

Assignees

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