How to make PyCharm / PyDev / other IDE applications to complete code for IronPython namespace?

I like PyCharm and used it before for my Python projects, but I just started talking to IronPython and I can't figure out how to make PyCharm or any other IDE (except VS, which works fine) recognizes .NET libraries.

For example, I have a code:

from System.Environment import * path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) 

The above code works fine, but the "System" part is grayed out everywhere with the message "Unresolved reference System". The IronPython documentation explains that System is not a module, but rather a namespace. If I do type(system) , I get <type 'namespace#'> . So, is there a way to get PyCharm / PyDev to recognize namespaces? On the one hand, PATH is fine, everything is fine.

+4
source share
3 answers

For performance reasons, PyCharm does not by default create Python stubs for .NET collectors. You can initiate the generation by placing the carriage on an unresolved link in the import statement, pressing Alt-Enter and selecting "Generate stubs for the binary module ..." quickfix.

+5
source

Just note that this should work correctly in PyDev (just make sure you are setting up the IronPython interpreter and setting up your project as an IronPython project).

One more note: the code above should be:

 from System import Environment path = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) 
+3
source

Not PyCharm, but Michael Ford has information on how to do this w / Wing: http://www.voidspace.org.uk/ironpython/wing-how-to.shtml - PyCharm may have a similar mechanism.

0
source

Source: https://habr.com/ru/post/1380966/


All Articles