IntelliSense not working for QSTK external module

Mar 3, 2013 at 7:29 PM
Hi, hope someone can help - I'm trying to use QSTK (Quant Software ToolKit, http://wiki.quantsoftware.org/index.php?title=QuantSoftware_ToolKit) with the plugin, but the IntelliSense doesn't work. The scanning part is working okay I think - the idb files are generated correctly, and if I strip off QSTK. from the start of the import statements then it picks up the types fine, i.e:

Broken: import QSTK.qstkutil.qsdateutil as du
Working: import qstkutil.qsdateutil as du

But stripping off the QSTK means the program doesn't actually run. I'm new to Python so am probably missing something obvious, but any help would be appreciated!
Coordinator
Mar 4, 2013 at 4:07 PM
This appears to be because when QSTK installs, they use a .pth file with code instead of creating a package.

An immediate workaround to get you going again is to open the QSTK folder (probably C:\Python27\Lib\site-packages\QSTK) and create an empty file in there called "init.py". You'll need to regenerate the database, but it should work fine after that.

Because that file is missing, we don't recognize the QSTK folder as part of the package. The interpreter uses the QSKT-0.2.5-py2.7-nspkg.pth file to modify your search paths at runtime so that you can find it. It is my understanding that running arbitrary code like this is an exploit rather than a feature, so it's unlikely we'll support it officially and in any case there's no way for us to parse their file correctly (it depends on being called from a specific function inside site.py). We'll discuss it internally and figure out what we can do to avoid this being a problem in future.
Mar 4, 2013 at 5:59 PM
That worked! Many thanks for the workaround and explanation, I'll feed that back to the QSTK guys. Also thanks for a fantastic tool, great to see MS investing in things like this - now I don't have to go put up with Eclipse :)

Steve