When start debug from Visual Studio, it takes like 2 minutes to hit the first line of python code. Apparently Visual Studio is busy loading python modules.
python.exe' (Win32): Loaded 'C:\ProgramData\Anaconda3\python.exe'. Symbols loaded.
'python.exe' (Win32): Loaded 'xxxxx'. Cannot find or open the PDB file.
... many more ...
I tried below, no joy:
Tools \ Options \ Debugging
a) Enable Just My Code checked
b) Just-In-Time Debugging - only selected Managed and Script
c) Symbols
unchecked "Microsoft Symbol Servers"
"Load all modules, unless excluded" or "Load only specified modules" (tried both)
https://devblogs.microsoft.com/devops/make-debugging-faster-with-visual-studio/
Reinstall Visual Studio (I tried both Community Edition, Standard Edition)
Reboot my machine three times
Delete all breakpoints
Disable Resharper
Two more observations:
I never had this issue prior to today
Python Interactive Debugger stopped working today - it refuse to print anything!
myDataFrame.head()
print("hello")
Fixed!!
I deleted my Visual Studio solution and project file. Create the python project brand new, all fixed!
Just in case anyone else is looking around,
I also had horrendous debug times (2+ minutes to get to the first line of code).
I was using an Anaconda deployment for numpy/scipy along with pybind11 to interface/debug C code.
I fixed my debug times by using a vanilla deployment of python (3.9.1) and installing the minimal requirements using pip. I believe it was taking so long because visual studio is searching for debug symbols that do not exist. Anaconda does not provide symbol libraries (nor will they according to their forums)
Debug times are now as fast as normal run times (<1s) and I'm no longer dreading hitting the little bug button.
To disable "Enable native code debugging" in the solution properties helped for me.
Related
I have a problem with one of the build-in python extensions.
After closing Visual Studio Code a new task starts, which takes up a considerable amount of processing power.
I have confirmed it to be related with the python vscode extension, as the problem does not occur after I uninstall it.
According to the info found in the official vscode-python repository it is a recent feature.
Has someone encountered a similar problem or could someone give me a hint on how to further inspect this problem ?
I installed ms-python.python. Normally I use Atom and I switch to VS Code for trying.
I have 2 questions :
I set linter to flake8 : Is it possible to verify in real time like Atom the python syntax or only possible when I save the file ?
Also, Atom show the content of vars : vars in Atom. There is a way to do the same thing on Visual Studio Code ? vars in VSC
Linting on change is not implemented, but there is a feature request for it
I have no issues seeing attributes, but I'm running on the development build of the extension so whatever issue you're running into may not be publicly released quite yet
Hopefully someone can give me a hand/few pointers.
So I am currently working on some python scripts and wanted to get some tests written.
My environment is as follows:
MS Visual Studio Community 2015, v.14 Update 3
PTVS v.2.2.4 (2.2.40623.00-14.0)
Python 3.5 64-bit Environment
I have some demo tests written in a test class, which have been appearing and disappearing in test explorer under their own will. Currently, I have none showing in Test Explorer, as per the screenshot below...
Several other people seem to be having issues, and the reasons vary from the test settings processor architecture selected, through to clearing the files in the temp folder etc.
I have been pulling out my hair for a few days now, and am looking for your help, cos i'm now bald.
I've tried removing PTVS and reinstalling, updating to latest, changing the test environment, adding and removing Nunit, incase that was conflicting, etc etc etc.
Any help would be greatly appreciated.
Just managed to get this error message to appear, but I do not think it's correct:
OK, so another update:
I decided that I would download VS CE 2013, and then install PTVS 2.2.3.
I opened the solution there, and the tests loaded instantly, and ran first time...
I know that is not a solution to the problem, but at least I can now run my tests and continue working.
Kindest Regards,
Ok, so it seems that PTVS does not fully work with VS2015 Community Edition.
You can run your scripts etc, but it does not integrate with the test explorer properly.
You will need to download VS2013 CE, and PTVS 2.2.2. Then you can run the test explorer and click run all, which will find all your tests, and run properly. Hope this helps someone, as I spent days trying to get VS2015 and PTVS 2.2.4 working with no luck.
I'm used to use VS to code C++ and Eclipse to code python but lately I have tried VS for both languages.
I found something very difficult to understand that while VS autocompletes it doesn't warn you about errors before runtime.
There is no warning regarding non existent variables or methods. I can't believe that VS does not warn about this kind of typical coding issues as it does for C++ code (as every IDE does).
What am I missing?
I tested this with VS2013 and VS2015.
I'm expecting something like:
Thanks
In order to get the python detailed IntelliSense support in VS2015 you have to install python tools for visual studio which provide the following:
CPython, PyPy, IronPython and more
Detailed IntelliSense
Interactive debugging
Integrated with Visual Studio features
Free and open-source
And the best thing, it's completely free.
Just download it from here:
https://www.visualstudio.com/en-us/features/python-vs.aspx
I hope it supports your question.
Update after comment:
You just need to refresh the Database. It works for me. Check to make sure the environment options are set (specifically path variable to PYTHONPATH) and the DB is refreshed.
Sometimes Deleting the __init__.py file in my source root directory did the trick
It seems that with a regular Python installation (2.x or 3.x in 32bit or 64bit) there are limited "warnings" (hovering over an undefined variable gives "unknown type"), but Syntax Highlighting / Intellisense doesn't seem to work.
Intellisense NOT Working:
Getting Intellisense to Work:
After some research I tried installing another Python interpreter for Visual Studio to work with. I went with Iron Python because it is "tightly integrated with the .NET Framework".
Download it from here --> http://ironpython.codeplex.com/downloads/get/970325
After installing IronPython open Visual Studio and set it as the "Default Environment for New Projects". You can set it in "Tools" --> "Python Tools" --> "Python Environments" (or by pressing Ctrl + K + `)
Make sure to refresh the database and Syntax Highlighting will start working. It doesn't seem very thorough, but it is there.
See photo below:
I'm using visual studio 2013 and the python tools for visual studio.
While setting up the project i've begun adding to the standard VS .gitignore as it doesn't cover the tools. I have a subdirectory labeled .ptvs in my environments folder. Currently it only seems to have logs in it.
Is there any risk that something important ever ends up there? Documentation is lacking in this area.
Thanks in advance.
The Python Tools Visual Studio seems to cache or generate files, logs and DB in the hidden folder .ptvs.
Since those data are generated, you should safely ignore that file and never version its content.
See for instance this discussion around the issue "Visual Studio 2010 freezes with PTVS 2.0RC":
Are you using or can you upgrade to our latest dev build and see if the issue goes away?
You may also want to try deleting the (hidden) .ptvs folder in your virtual environment and recreating the DB from scratch.