Using PyCharm for editing RhinoPython


PyCharm from JetBrains is one of the most powerful IDE for python, and i don’t think Rhino development team need to put a lot of recourse to make EditPythonScript as good as PyCharm or other IDEs.

So i try to use PyCharm for editing python for rhino, but i don’t know how to make PyCharm understand the RhinoPython module structure. (i.e. after i type “rs”, no hints of method appear, and “import rhinoscriptsyntax as rs” is shown with error)

Do anyone try to use PyCharm for editing before? If so, can you share how you make PyCharm understand the modules of RhinoPython?


Rhino Library for Pycharm
(Giulio Piacentino) #2

Hi James,

I did not try that specific IDE, but usually you need to find the way for it to find your file. You usually do that by adding the folder:
%appdata%\McNeel\Rhinoceros\5.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib
to the Python PATH used by the “Intellisense” feature of that IDE.

I hope this helps,


Giulio Piacentino
for Robert McNeel & Associates


Has anyone got PyCharm to work with Rhino. I am having trouble importing the Rhino Python Libraries.

(Alain Cormier) #4


To add the path to the Rhino Python lib that Giulio mentions above in PyCharm

  • select “Settings…” from the “File” menu.
  • click on Project Interpreter / Python Interpreters on the left.
  • make sure IronPython is your selected interpreter (top right).
  • click the “Paths” tab (bottom right)
  • add the path mentioned by Giulio. If the dialog doesn’t let you browse there, you can cut and paste the path from explorer.

Hope that helps

(Giulio Piacentino) #5

I’ve just tested the method proposed by Alain, and it will work great for import rhinoscriptsyntax, which is already helpful. It will not work with import Rhino (RhinoCommon.dll) as it stands. The reason is that there are a couple of quirks in that editor to make IronPython assembly load, and even then not everything will be perfect, but still much better than nothing. If you wish to use Rhino there, do this:

  • add also the path to RhinoCommon.dll (32-bit or not according to the IPy interpreter that you use) to the list of paths (same as in Alain’s answer above). On my system, this is:
    C:\Program Files (x86)\Rhinoceros 5\System\
  • add these few lines of code to your script:
import clr
import Rhino
import Rhino.Geometry```

 * place the caret (click on) the word "Rhino" besides import
 * press Alt+Enter
 * select "Create skeleton implementation for binary import" (or very similar)
Now repeat this for all missing imports. You can also use my skeletons and place them in the 'binary skeletons' folder.<img src="/uploads/default/10796/55ae636bf428b67d.JPG" width="690" height="304"> I've pre-exported all RhinoCommon namespaces as of today for you in this zip.

<a class="attachment" href="/uploads/default/10797/"></a> (299.4 KB) 

This is what you get:
<img src="/uploads/default/10799/b89b3a0a25bdb638.jpg" width="690" height="342"> 

I hope this might also be helpful,

Giulio Piacentino
for Robert McNeel & Associates


Do we have to use IronPython as our interpreter? Can we use Anaconda’s python.exe?

(Steve Baer) #7

IronPython is the interpreter that Rhino uses.


I managed to get all the hints to the methods to appear but when I run my debugger I get an error. See screenshot.

Error Message:
“C:\Program Files (x86)\IronPython 2.7\ipy.exe” C:/Users/marafi/PycharmProjects/RhinoTest/
Traceback (most recent call last):
File “C:/Users/marafi/PycharmProjects/RhinoTest/”, line 3, in
File “C:\Users\marafi\AppData\Roaming\McNeel\Rhinoceros\5.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\”, line 2, in
File “C:\Users\marafi\AppData\Roaming\McNeel\Rhinoceros\5.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\”, line 8, in
File “C:\Users\marafi\AppData\Roaming\McNeel\Rhinoceros\5.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\rhinoscript\”, line 1, in
File “C:\Users\marafi\AppData\Roaming\McNeel\Rhinoceros\5.0\Plug-ins\IronPython (814d908a-e25c-493d-97e9-ee3861957f49)\settings\lib\”, line 2, in
AttributeError: ‘LightException’ object has no attribute ‘Host’

(Giulio Piacentino) #9

Of course. You need a running instance of Rhino to execute Rhinoscripts. You might be able to run remote debugging in Rhino, though. With this method.

I hope this helps,


Giulio Piacentino
for Robert McNeel & Associates

(Alain Cormier) #10

And I believe only the Professional edition of PyCharm supports remote debugging.


I’m still getting this error trying to set up Rhinoscripting with Eclipse + Pydev:
AttributeError: ‘LightException’ object has no attribute ‘Host’

I have Rhino 32-bit up when running the script in Eclipse, but still getting the error.

Basically, I have Exlipse (JUNO) + Pydev + IronPython set up with all the right paths and the builtin as Steve suggested in his tutorial:
After set up, I create a new Pydev project and a new module within where I paste in a piece of python code I’ve successfully ran in Rhino’s built-in Python editor. An instance of Rhino 32-bit is also open at the same time. But still getting the error.

Any ideas what I’m doing wrong?

(Alain Cormier) #12

You can edit the script in PyCharm or PyDev but you can’t execute it directly from there. The script has to run in the context of Rhino. You can setup your IDE for remote debugging to step into your code like described above or in my reply to your other post.


Hi @Alain,

I want to use Pycharm Community edition to write and edit python code I write for GhPython components in grasshopper. I stumbled upon this thread during my search for possible solutions. I want to follow the steps you mentioned. However, in the list of project interpreters I don’t see IronPython. I tried to use it from my local drive, but coould not successfullly locate a .exe file for IronPython. I could only locate a .dll file.

can you please help?

(Giulio Piacentino) #14

@Devang_Chauhan it would be better to start a new topic. This one was about _EditPythonScript. If you want to reply, please choose the link icon -> then New Topic . If your goal is just writing, then it would be easy to just add a File Reader, and input the content into the ‘Code’ input of a GhPython component.

(Graham) #15

Hi all,
I have started using Pycharm Community Edition to edit my python scripts for Rhino and then executing them as normal in Rhino 5 using EditPythonScript or RunPythonScript.
I forked this repo and imported it into Pycharm (VCS - checkout - github) to get ‘stub’ files giving the autocomplete and quicklook <ctrl + Q> information for rhinoscriptsyntax, Rhino, clr, scriptcontext, etc. Please note that the currently included stubs are for Rhino 5 and include only documentation, but no code so you can’t execute them. I havent tried using it to generate my own stubs but it should be possible to do this for Rhino 6.
I then started a new project in Pycharm, went to ‘project structure’ in settings and pointed to the /release/stubs folder as a ‘Content Root’. This lets Pycharm know where to look for docstrings
Finally under Inspections I checked Python 2.7 and unchecked all other versions of Python.
Seems to be working well so far… Any advice / comments welcome on this if you have another way of doing thing.

Autocomplete while editing python scripts outside of Rhino
Rhino inside Python