Code change:
VS Code version: Code - Insiders 1.84.0-insider (, 2023-10-27T10:41:08.734Z) OS version: WindowsNT x64 10.0. Try applying these variables using the environment collection API: Even though screenshot says they're applied as expected: ! equal sign is stripped from the end when printing the value: ! <details<summaryOriginal bug report </summary<pfrom dotenv import loaddotenv; import os with open(".env", "r") as f: f.readlines() ("TESTKEY") ("TESTKEY2") ("TESTKEY3") ("TESTKEY_4") envFile: "<placeholder" venvPath: "<placeholder" venvFolders: "<placeholder" languageServer: "Pylance" testing • unittestEnabled: true experiments • optInto: ["pythonTerminalEnvVarActivation"] </p</details
! Showing the environment variables have the '=' after I unset Python: Env File ! Showing the environment variables do not have '=' sign if loaded from the Python extension
Thanks for the bug report! We investigate issues in order based on priority and severity, which includes the impact it has on your ability to use the extension to do productive work, and the number of people affected. If other users come forward and leave a comment demonstrating they are seeing/reproducing the problem then we will raise this issue's priority. Thanks for understanding and the patience!
Thank you. I'm adding some more information if it can be useful in finding the problem. I cleared the python extension cache after re-setting the "Env File" setting, because I noticed it was loading a cached value. ! Note that when reading here in the trace log, the environment variable KEY2 has the equal sign at the end, and it's in a different color. The equal sign is also in the output of ".vscode-insiders/extensions/ms-" As far as I can tell the parsing code at is correct, and captures all the equal signs in the key. Hence the sign appears in all of the logs in the output tab, it's just not there in the terminal and/or python if the .env file is loaded by the extension: ! Last, I don't know if it's related, I'm getting the following debug messages from the Pylance extension:
Thanks, I'm able to reproduce it. Looks like an issue with environment collection API in VS Code itself, hence transferring.
This makes sense as we currently split on and so those characters won't work currently when applied via shell integration: For pwsh:
I have this issue too. I noticed if I run my backend server (which takes a secret key from the .env file) in my system terminal it behaves as expected, but if I run it in the vscode terminal it truncates the key after the equals sign in the key. This broke my backend! Please fix this. Thanks.
I face this issue too. Waiting for fixing. Thanks As a potential workaround, you can run the command directly from the terminal after every .env file changes for each terminal window
I am having the same issue when the project is setup for a C++ python extension with leak sanitizers. This requires to the sanitizer library and disable leak detection via . Unfortunately, in the terminal only remains which yields to a unusable terminal due to See
I am also experiencing this issue with a Django Secret key containing an '=' sign and would appreciate a fix. I can work around it, but it's not ideal since this runs counter to the expected behavior and how the command behaves. Thank you.
This so frustrating. I had my code working perfectly I was testing the whole day and then suddenly it broke. I spent hours figuring it out. I managed to debug it and found that the == signs in the .env variables were stripped out. I was so confused why did it work earlier and then I realised that a new version of VS Code was installed today. Did it break my code?Not 100% sure . Anyway VS Code is awesome. But the lesson of the day : stable environment . Don't update it constantly.
I'm facing the same issue. Here are some potential clues based on my project: it only occurs in the init constructor for a class. The class is located in a .py that is in a different folder than the .env. The error occurs when the code is invoked from an api endpoint but works fine otherwise. I tried making adjustments by setting the .env path explicitly but no luck. Please help.
Adding my use case: Azure services often have a connection string that's used when coding some integration and said strings usually have the '=' in them, For me, the problem can be mitigated if I leave the python.envFile config value empty, but it is a bit annoying that this "automatic" feature is somewhat hidden
Can confirm that I am also seeing this behavior in the exact same situation. VSCode Terminal - drops "=" ! Plain Terminal - returns correct !
Verification steps: Create an extension that does: Debug the extension Activate it Open a powershell terminal Run , ensure that it prints Repeat the same in a bash terminal but run
This still had an issue for fish shell which should be fixed in To verify, repeat steps above but for fish.
verified bash/fish/zsh

Related discussion:
text: if ($env:VSCODE_ENV_APPEND) { $Split = $env:VSCODE_ENV_APPEND.Split(":") foreach ($Item in $Split) { <del> $Inner = $Item.Split('=') </del> <ins> $Inner = $Item.Split('=', 2) </ins> [Environment]::SetEnvironmentVariable($Inner[0], [Environment]::GetEnvironmentVariable($Inner[0]) + $Inner[1].Replace('x3a', ':')) } $env:VSCODE_ENV_APPEND = $null