Does Intellisense Completion Analyzer ignore modules from .pth files and PYTHONPATH

Apr 20, 2011 at 5:51 AM
Edited Apr 20, 2011 at 5:53 AM

I am using beta 2 of PTVS with Cpython 2.6 on Win 7 32 bit. After installing PTVS, I ran "Generate Intellisense Database" command with "Generate built-in and standard library database" option. In my python26 site-packages directory, i have few custom site-packages such as lxml and comtypes and a .pth file which contains paths to python modules in other directories which are not within python26 install directory. I also have PYTHONPATH env variable set to some other directories containing python modules outside of python26 install directory. After the intellisense database update process completes, I get intellisense for all modules from standard library as well site packages such as lxml and comtypes. However I do not get any intellisense for python modules included in the .pth file or PYTHONPATH. Is this a known limitation or I am missing something?

May 4, 2011 at 3:48 AM

The PYTHONPATH is a known limitation, we don't don't look at that. Projects have a search path settings and we will likely look at that in the future (you can vote for this feature here: We should support .pth files as well and I've opened and issue for that:

Jul 13, 2011 at 2:53 PM

I can't seem to get the Intellisense to work / analysis on script (not Python27 interactive) when using a .pth file with PTVS RC1 without a project.  I have a .pth file in C:\\Python27\\Lib\\site-packages that is correctly helping to add a path to my custom .NET .dll's in another location.  In the custom folder as well is the Python 2.7 support dlls for "Python.NET". The package allows creating a class instance called 'Rack' that bascially pulls all the .NET lab devices I use into one class for control.  I've generated the code base in PTVS for the Python2.7 interpreter.   When I use the Python2.7 interactive, I can create an instance of the class Rack() after importing the loadrack module and I can see / access all the members of the class nicely with intellisense in the interactive window.  I can also create a Python project and specifically add the path to that custom folder in the Solution Explorer -> Intellisense picks it up in the script as I'm typing things out.  However, if I don't create a project and add the search path (replicating the .pth file's actions), I don't see intellisense in the script file as I type things out.  I assumed no-project intellisense for standalone scripts would be supported in PVST based on the bug fix above, but it doesn't seem the case.  Is this working as expected? (ie: need project and search path) or is it a bug that the Interactive picks it up but the analysis for the script does not?

Jul 14, 2011 at 2:27 AM

Opening a file when it doesn't live in a project is a special case and there could be a bug there. (It gets opened in an implicit project.)  Do you have more than one interpreter installed? What's your default interpreter setting?

It's not necessarily a bug that you get different intellisense in the REPL than in your project. We do extra analysis inside the REPL, and we can also introspect live objects. 

Jul 14, 2011 at 1:14 PM

I had Python 2.7.2 + Ironpython 2.7 installed.  Default interpreter in PVST was Python 2.7. 

As a side note, although I had mentioned I was able to see the object instance intellisense in the script file when I had a project + search path to my custom .NET files, I later found that I could not drill down to see the methods/functions of objects - though using the same commands, this was possible in the REPL which makes sense to what you are saying. 

Side note number 2:  I took another machine and installed Python(x,y).  I saw the same behavior in the Spyder IDE -ie: can see the objects but doesn't 'drilll down' to the methods.  However, using the Eclipse IDE that is part of this package I tried setting the interpreter to Python 2.6 (installed with Python(x,y)) and gave it pointers to all the default settings + my custom lib folder which it found from the .pth file.  After I did this, I was able to create the .NET object instances in any file I moved into the IDE (not just the one in the project) and see all the class methods/members/attributes + the method signatures. I have to admit it was nice.

My main goal is to do everything I can in Labview, but in Python or Ironpthon (C-code, graphing, fft and other numpy/scipy-type calcs, .NET lib control intellisense for everything).  So far, the Python(x,y) using Eclipse covers it all - I just had to rebuild PythonNet from source with VS2010 to target x86/x64/.NET 4.0.  However, I've been using VS20xx for quite some time now and would like to stay with it if possible.  I think you guys are doing an awesome job and would prefer to stick with PTVS and Python 2.7 if possible - provided the / / Sho packages harden up a bit.