Debugging no longer adds the root folder to PYTHON_PATH
See original GitHub issueEnvironment data
- VS Code version: Version: 1.29.0 (user setup) Commit: 5f24c93878bd4bc645a4a17c620e2487b11005f9 Date: 2018-11-12T07:47:15.448Z Electron: 2.0.12 Chrome: 61.0.3163.100 Node.js: 8.9.3 V8: 6.1.534.41 Architecture: x64
- Extension version (available under the Extensions sidebar): 2018.10.1
- OS and version: Windows 10 enterprise
- Python version (& distribution if applicable, e.g. Anaconda): Python 3.6.5 64 bit with Anaconda
- Type of virtual environment used (N/A | venv | virtualenv | conda | …): conda
- Relevant/affected Python packages and their versions: ----
Actual behavior
When debugging from outside of the root folder. imports from the root folder no longer work. Selecting the text, and doing shift+Enter to execute within a python console work as expected (“python.execSelectionInTerminal”)
Expected behavior
I should be able to import package from inside my root folder, even if I start debugging from files in a subdirectory of my root folder.
This behavior was working beofre updating the current version of vscode and python
Steps to reproduce:
- clone https://github.com/AlexandreOuellet/vscode-import-bug and open the folder in vscode
- open the file tests/test_some_test.py
- Debug this file (through F5)
Logs
Output for Python
in the Output
panel (View
→Output
, change the drop-down the upper-right of the Output
panel to Python
)
Starting Jedi Python language engine.
##########Linting Output - pylint##########
--------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)
##########Linting Output - pylint##########
--------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)
Output from Console
under the Developer Tools
panel (toggle Developer Tools on under Help
)
Issue Analytics
- State:
- Created 5 years ago
- Comments:5
Top Results From Across the Web
How to set the root directory for Visual Studio Code Python ...
Go to File > Preferences > Settings, search for pythonpath. Under the Pylance options you should see Extra Paths, this is where you...
Read more >PYTHONPATH not handled correctly by Run/Debug ...
Pycharm's run and debug environment isn't updating the PYTHONPATH to include the content roots and source roots. I have to uncheck and check...
Read more >Source Path (Debugging with GDB) - sourceware.org
If a compilation directory is recorded in the debug information, and GDB has not found the source file after the first search using...
Read more >The Module Search Path - Real Python
In this video, you're going to explore the module search path. So, where can you import a module from? When the interpreter executes...
Read more >Debugging configurations for Python apps in Visual Studio Code
vscode folder in your workspace. Note: To change debugging configuration, your code must be stored in a folder. To initialize debug configurations, first...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Please see temporary work around in https://github.com/Microsoft/vscode-python/issues/3309#issuecomment-438753056
I just create a simple python project, with last update version of visual studio code, using also last version of the plugin [2018.10.1 (09 Nov 2018)], and getting this error:
And each folder I have the
__init__.py
fileprogram.py
logger.py