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

Intellisense: Questions regarding cElementTree / custom modules

Apr 12, 2013 at 11:14 PM
Edited Apr 12, 2013 at 11:27 PM
I'm using VS2010 / Python 64 3.3 -- intellisense seems to work for most builtins, but I have two problems:

Problem #1
Why doesn't the following work? Is it because its not a straight import?
from xml.etree.cElementTree import parse
doc = parse (<some path>)
doc. <-- no suggestions :(  How come?
Problem #2
I have a script containing some helper functions and load it like a module (I'm sorry for my naivete here -- I realize I may be breaking a slew of conventions - but have not yet seen/understood a better way):
#batteries not-included
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..\\my_library\\'))
import my_lib_xml
my_lib_xml.  <-- no suggestions :(  How come?
Is there something I can do to fix this so Intellisense provides the hints?

Apr 12, 2013 at 11:57 PM
Problem 1 looks like it's our fault, though I can't tell you exactly why - we just aren't flowing the types through properly. You may be able to help by using ElementTree rather than cElementTree (which has been deprecated in Python 3.3), but there's no good reason for why we don't know what type doc is. I'll file a bug.

Problem 2 is because we don't detect when you modify sys.path in your program. If you're using a project and the path is stable, you can add it to the Search Paths element in Solution Explorer. We will also add it to sys.path for you when running from within VS, though you'll need to add it to PYTHONPATH manually when running from the command line.

However, if you can't be sure what the path is before you start running, then neither can we, and there's no way we can figure out where that module is.
Apr 15, 2013 at 6:17 PM
Thanks for the reply Zooba.

Problem #2 is no longer an issue for me after following your instructions.

I'll keep my eyes peeled for future releases which may fix the xml.etree.ElementTree bug.
Apr 29, 2013 at 5:05 PM
I was having the same issue, but more explicitly...'

import ModuleXyz

obj1 = ModuleXyz.SomeClass()
obj1. <-- <No Type Information Found>

So i dug a little deeper and it turns out that intellisense didn't know about ModuleXyz even though i imported it manually, so then i added the directory to the Search Path (this this case current dir "."), then i right clicked on the module, and did a resolve->import ModuleXyz, and magically all of the type information was populated.