This project has moved and is read-only. For the latest updates, please go here.

Intellisense not deep (or absent) for PyQt4

Sep 12, 2012 at 7:32 PM

I know the subject has come up before in posts (and I have read all them).   But I can not get PTVS intellisense to work with PyQt4.

I generated the database multiple times. Tried different machines and also a 1.1 as well as the latest beta of PTVS.  Same result on all.

At first you get just some '_' type attributes.  After you generate the competion database, you can go as far as PyQt4.QtCore....and PyQt.QtGUI, but that's it: no attributes or information beyond that.

If there is one package you really need intellesense for it is PyQt4. 

Note that intellisense works flawlessly for any python library I have source files for.

Am looking for any ideas or workarounds.  I love PTVS above all...but I'll need to use IDLE or something else for GUI programming if I can't find a fix here.

I have diag file, but can't find any place to upload it here...maybe I am getting dense in my old age...

Sep 12, 2012 at 7:43 PM

If you open the REPL window and import PyQt4, how deep does the intellisense go?  

Some libraries have dynamically generated members. Static analysis can only go as deep as the statically declared members, but the REPL is smart and inspects the run-time objects, so it might be able to do better for you. (This doesn't help in coding, but it will help troubleshoot what is going on.)

Sep 13, 2012 at 3:54 PM

It depends on the installation.  On some machines I get as far as PyQt4.QtGui or QtCore, but nothing after that.

On other installations, I get nothing but '_' attributes which means nothing at all.

I thought that PyQt might have a lot of dynamic bindings given that it is a C++ library at its heart, but IDLE is able to pull this off somehow. 

Is there a way I can inform intellisense somehow?  Anything I can do?


Also, it isn't clear to me on "generate completion" database.  Do I need to do this for every interpreter I have or just once and that covers all  python interpreters?




Sep 13, 2012 at 4:59 PM

Worked a little more on this. You are right about interactively getting information on REPL.

Is there any way we can inform the editor above what repl has learned by introspecting the objects?  That's where I really need the intellisense.  Nice to have in the interpreter, but even better to have in the source code editor. 

Sep 14, 2012 at 4:31 PM
Edited Sep 14, 2012 at 4:31 PM

Unfortunately not, the editor is deliberately quite conservative here. What we need to fix is the initial scraping of C libraries - this is done in a Python script running in the same interpreter, so it should work fine, but clearly it doesn't. (Most of the source for this is available in the installation directory, so if you want to speed this up you can poke around in and help us figure out exactly what's going wrong.)

And on the "generate completion DB" step, that runs the scraper script in the selected interpreter and writes the output as pickled dicts to C:\Users\<username>\AppData\Local\Python Tools\CompletionDB. You can load these with Python (pickle.load(open(path, 'rb'))) and if you really want you can modify and save them, though I highly doubt that's going to be a good use of your time.

Sep 14, 2012 at 11:27 PM

Just letting you know that we've had a look and made some improvements here. It's still not perfect, but PyQt doesn't seem to have a lot of information built in. Our next release (very, very soon!) will find most, if not all of the completions available.

If you want the fix sooner, you should be able to replace and in your install directory with the versions from this changeset and then rebuild your completion DB.

Thanks for the feedback.

Sep 15, 2012 at 3:45 PM

I have to say, you guys are such a pleasure:  I have great confidence in using this PTVS in an enterprise environment because of how good your support is.   As we work with this, I will make sure to roll any enhancements, etc. we find back up to you.   I will try the files from the changeset and see how these do...


Thank you again...



Sep 15, 2012 at 4:59 PM

One caveat on that fix - you should only copy the changes from that changeset and not the entire files. We've changed the database version since the last release, so it won't be recognised by the loader with a newer version number. This will make it regenerate the database every time you start, and it probably won't load it even then.

I don't remember exactly what version it should be, but it shows up in here (search for 'database.ver' to find it):

f = open(os.path.join(outpath, 'database.ver'), 'w')

As long as you don't change that number it should be fine. Unfortunately, just making PTVS accept the newer version can't be done without a full build.

Sep 20, 2012 at 7:15 PM

This is fixed in 1.5 RC.