Intellisense with Standard .Net Libraries

Mar 6, 2012 at 3:24 AM

Hi All,

Just started using PTVS and am noticing that the intellisense only seems to cover the native python libraries but not the standard .Net libraries.

For instance I just created a WPF application and noticed that in the event callbacks intellisense doesnt have any information about the objects passed to the callback. When I hover over these objects I get the message <no type information available>.

Is this a known limitation or have I not installed something correctly?

 

Thanks

Coordinator
Mar 6, 2012 at 3:26 AM

How is your Python interpreter configured for the project (in project properties)?  Is it the IronPython interpreter as found from the registry?  Another way to check is to see if you get completions for System after typing import.

If it's not that interpreter then it won't know to use .NET to provide extra intellisense. 

Mar 6, 2012 at 3:49 AM

I checked the python interpreter and it was configured to use Python 2.5 so I have changed that back to use IronPython 2.7.

I tried typing import System and I do get completions for the standard libraries after that but I did notice that System.Windows is not in the list.

The list of completions I have after System is:

 

CodeDom

Collections

ComponentModel

Configuration

Deployment

Diagnostics

Globalization

IO

Media

Net

Reflection

Resources

Runtime

Security

Text

Threading

Timers

Web

 

When I actually import System.Windows to get a WPF application running it seems to import and run fine, its just not in the intellisense database.

Coordinator
Mar 6, 2012 at 4:22 AM

Is there a call to "import wpf" or "import clr" + "clr.AddReference('PresentationCore')" or some other WPF assembly somewhere in your code?  Once we see one of those we should make completions from the major WPF assemblies or the specific assembly add ref'd.

Aug 20, 2012 at 2:37 PM

Can't run IronPython WPF...

I am running VS 2010 pro and just installed Python Tools. If I run just a basic python project everything shows up fine (for right now I've only tested simple console output projects). However, if I create a new WPF application (File > New > Project > IronPython WPF Application)  and try to run it (it doesn't matter what I put on the form: nothing, label, or textbox) then it errors out and never even displays the form. The error occurs at the 'import wpf' line of the .py file stating "No module named wpf". If I begin typing 'import ' on a new line then intellisense displays wpf in the drop down so it should be available.

What would be causing this error and how can I correct it?

Thanks.

Coordinator
Aug 22, 2012 at 12:05 AM

Are you just running against the version of IronPython downloaded from IronPython.codeplex.com which installs via an MSI?  When you install it there should have been a IronPython.Wpf.dll which is at:

C:\Program Files (x86)\IronPython 2.7\DLLs\IronPython.Wpf.dll

which provides the wpf module.    If you're missing that somehow then the wpf module won't be available and you'll get this error. 

Another reason would be if you were running against the wrong interpreter version.  For example if you have CPython installed but not IronPython we'll pick it up as the only interpreter available and try running against it.  Downloading and installing IronPython (and then restarting VS) would fix it if that's the problem.

Oct 13, 2012 at 1:37 AM

I encountered the same situation。

Used for the first time when the normal work,I created a WPF project。

Close VS and restart the system (installed windows update).IntelliSense abnormal 

I first created a WPF project. IntelliSense tips

“import System.Windows.Forms”

WPF projects created in the second, and can not be listed "System.Window"

Debugging and running normal

ironpyton 2.7.3

PTVS 1.5 RC

Apr 12, 2013 at 12:57 PM
For me System.Windows didn't show up in Intellisense also in PTVS 2.0 Alpha. So I tried what dinov suggested. I added all my References with an additional clr.AddReference. Then it worked perfectly. HTH.