![]() ![]() I am using VSCode and the weird thing is: VSCode finds my imported functions inside test_code.py.įrom. But this is not an option since I have many modules and that is why I need to put ALL test modules inside a test-folder for organizing. If I move test_code.py out to root/ everything works fine. Whenever I run pytest standing in root/ I get ImportError : Attempted relative import with no known parent package. This package is automatically imported in any Python Interactive Window when importing ptvsd, no matter which version is installed in the target Python environment - I suppose this is a bug.This is what my project looks like (oversimplified): root/ ![]() You are indeed right that the legacy version of ptvsd built into Visual Studio is stored at %ProgramFiles(x86)%\microsoft visual studio\2017\community\common7\ide\extensions\microsoft\python\core\ptvsd\ (replace 2017 with 2019 for VS2019 and Professional with your edition of the VS). The legacy debugger stayed the same as in Visual Studio 2017, i.e. In some cases (Python 3.4, for example, for which debugpy was never available), the only option there is to drop to the legacy debugger. Starting with Visual Studio 2019, Microsoft apparently dropped support for then up-to-date releases of ptvsd in favour of debugpy which they picked as the default Python debugger. I would name such debugger support highly experimental. However, attempts to use ptvsd 4.1.1a9, 4.1.1 or more up-to-date versions like 4.3.2 result in either failures to connect to the Python process to be debugged, or in frequent freezes of Visual Studio. In my distribution of VS2017 (Professional Edition), the latest Python debugger utilized in Visual Studio 2017 is in fact located at %ProgramFiles(x86)%\microsoft visual studio\2017\Professional\common7\ide\extensions\microsoft\python\core\Packages\ptvsd\, (see _version.py). It appears from Microsoft's documentation (see ) and source code of the debugger shipped with Visual Studio 2017 that the Python debugger built into Visual Studio 2017 was based on ptvsd 4.1.1a9 debugger. You need to import that one in your Python project before attaching to a running Python process. In both VS2017 and VS2019, the legacy debugger is based on ptvsd 3.2.1.0 (with some auxiliary scripts referring to 3.1 and 3.2). > Python -> Debugging and check Use legacy debugger. To enable the legacy debugger, go to Debug -> Options. Sadly, Microsoft droped support for the ptvsd debugger completely with Visual Studio 2022. This was the only option which worked for me in conjunction with Python 3.4 and Microsoft Visual Studio 20. What do I need to use the current version of PTVSD?.When using PTVSD 3.2.1 on both machines, visual studio complains when starting the debug that there would be a newer version (4.1.1a9) installed on the local machine. On the remote machine the current version of PTVSD is installed and used. The packet version installed in the core seems to override the newer package installed in the environment. ![]() But when I repeat the above import statement I still see Version 3.2.1.0. If I install ptvsd in the python environment, the current version 4.2.0 is correctly installed. When opening a python console in visual studio in my current environment and import ptvsd, i allways get version 3.2.1.0 which is installed in %ProgramFiles(x86)%\microsoft visual studio\2017\community\common7\ide\extensions\microsoft\python\core\ptvsd\. When I try to remote debug using ptvsd I see different versions depending where I import ptvsd. I use Visual Studio 2017 (V15.8.9) with python tools. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |