gtalarico / ironpython-stubs

Autocomplete stubs for common IronPython/.NET libraries
Other
248 stars 80 forks source link

Pycharm Integration : Unavailable classes #23

Open Maozerhouni opened 3 years ago

Maozerhouni commented 3 years ago

Hi,

I installed the stubs. I am trying to use them in Pycharm. I am using Python 3.6.

When trying to import clr, it raises many errors. Mostly unavailable classes. For Example : File "C:/Users/TOSHIBA/AppData/Roaming/JetBrains/PyCharmCE2020.1/scratches/scratch.py", line 1, in import clr File "C:\ProgramData\Anaconda3\envs\EnvPy36\lib\clr.py", line 702, in class RuntimeReturnChecker(PythonTypeSlot): NameError: name 'PythonTypeSlot' is not defined

What am I doing wrong ?

gtalarico commented 3 years ago

Hi @Maozerhouni

You don't need these stubs to use pycharm. PyCharm auto-generates stubs from you In fact, this project uses pycharm code to generate stubs for use in other editors (generator3.py)

You should undo any changes you did, and in pycharm use the Generate stubs feature - I think you right click the module name or something, not sure where exactly since I don't have pycharm installed

Maozerhouni commented 3 years ago

Hi @gtalarico, Thanks for answering. and thanks for this great work.

I corrected some SyntaxError that stop the code for running (For example, in clr, line 26 def accepts(types,p_object=None): # real signature unknown; restored from doc should be changed to def accepts(p_object=None,types): # real signature unknown; restored from _doc)

but after that, many classes seems to be missing. I guess I missed somepart about integrating NET Framework with pycharm, as most of the classes seems to exist in other modules or other dll files. For example ISerialization, which is used in clr and in other classes through System. But that I couldn't find. For example, IStrongbox (line 585 in clr.py), List,IList ... (line 611 in clr.py), IDisposable for Revit.py. This raises an error while running clr importation.

What I don't get is that the some tools seems to work fine in a simple IronPython console, but not in PyCharm.

I have IronPython installed. I runned pycharm with Python2.7, and Ironpython. both didn't work in pycharm.

Did you face similar issues ?

Thanks for your answer

toothless92 commented 1 year ago

Leaving this for others that may find it useful, I have made a script to fix typing issues, see here: https://github.com/gtalarico/ironpython-stubs/pull/35