Using intellisense with my assemblies

Sep 7, 2011 at 10:31 AM

python tools intellisense/autocompletion seems to be working ok in my visual studio.
if I type : "from sys import "
autocompletion shows up perfect.

But how do I register my own dlls with their members with the python editor
so I can use the intellisense features also with my dlls?

Can anybody give me hint?
thank you very much in advance
MarkusO

Coordinator
Sep 8, 2011 at 4:44 AM

Are your DLLs pyds used from CPython or DLLs used in IronPython?

For the former if they're installed in site-packages or the DLLs directory in the Python installation we'll attempt to get top-level information for their members.  If you installed them after running PTVS you may need to re-generate the completion database in Tools->Options->Python Tools->Interpreter.  You might want to vote for this bug as well as we don't yet have a way to pre-generate the completion datbase for these if they're somewhere else: http://pytools.codeplex.com/workitem/408

If this is IronPython and the DLLs are .NET DLLs then the solution is to make sure that there's a call to clr.AddReference('YourAssemblyName') and that the assembly can be successfully loaded by the VS process.  One way to accomplish that is to make sure the DLLs are in your search paths for the project (using the Search Paths node in Solution Explorer or manually adding the path name in the project properties page).  Another way would be to put the assembly in the GAC. 

 

Oct 17, 2011 at 9:57 PM

How many references can I add in one single .py file? 

If I have two or more references, PTVS seems to get the definitions for only the first assembly being referenced. For instance, I get no autocompletion for the types in Assembly2 below nor does the IronPython runtime recognize the types in it.

 

import clr

clr.AddReference('Assembly1')

from Assembly1Namespace import *

clr.AddReference('Assembly2')

Oct 17, 2011 at 10:01 PM

An additional note is that if I change the script to the one below, it keeps recognizing Assembly1 types, not Assembly 2. All assemblies are .NET 4

import clr

clr.AddReference('Assembly2')