# Importing IronPython libraries

**URL:** <https://discourse.mcneel.com/t/importing-ironpython-libraries/100288>\
**Category:** Scripting\
**Created:** [April 15, 2020, 1:30pm UTC](https://discourse.mcneel.com/t/importing-ironpython-libraries/100288 "2020-04-15T13:30:18Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![D.Ronald](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/d.ronald/32/441716_2.png) [@D.Ronald](https://discourse.mcneel.com/u/D.Ronald)\
**Post date:** [April 15, 2020, 1:30pm UTC](https://discourse.mcneel.com/t/importing-ironpython-libraries/100288/1 "2020-04-15T13:30:18Z")

</div>

I also have the same problem importing other IronPython libraries, such as the **urllib** and **urllib2** for writing web requests. I’m using Rhino 6 SR 24 on Windows.

---

<div class="post-metadata">

**Author:** ![AndersDeleuran](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/andersdeleuran/32/476683_2.png) [@AndersDeleuran](https://discourse.mcneel.com/u/AndersDeleuran)\
**Post date:** [April 15, 2020, 1:37pm UTC](https://discourse.mcneel.com/t/importing-ironpython-libraries/100288/2 "2020-04-15T13:37:09Z")

</div>

They seem to import okay for me on Windows:

 ![2020-04-15 15_35_59-Grasshopper - unnamed](https://global.discourse-cdn.com/mcneel/uploads/default/original/3X/5/e/5e431c481372bfd80994def9ab6b456e413cefa8.png)

---

<div class="post-metadata">

**Author:** ![D.Ronald](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/d.ronald/32/441716_2.png) [@D.Ronald](https://discourse.mcneel.com/u/D.Ronald)\
**Post date:** [April 16, 2020, 6:26pm UTC](https://discourse.mcneel.com/t/importing-ironpython-libraries/100288/3 "2020-04-16T18:26:12Z")

</div>

Anders.  
Thanks for your reply!  
In this screenshot, you see what I get:

- I don’t get the intellisense option to import
- I cannot check the dir(urllib)
- I cannot import the long list of IronPython modules

In fact, many modules don’t show up from the IronPython Lib folder.  
I have already troubleshooted:

1. setting default search folders in Python Edit window \> Options
2. making sure that the files aren’t blocked on Windows

Setup:

- running Windows 10 version 10.0.18363 Build 18363
- running bootcamp on a MacBook Pro 2013
- running Rhino 6 sr 24 (education)

None of this is unusual. There seems to be something blocking the imports of the other Python modules?

 ![ironpython bugs](https://global.discourse-cdn.com/mcneel/uploads/default/original/3X/e/a/ea11a8454edd6920eb7b7bf27a554e97afdd5196.jpeg)  
 ![ironpython bugs2](https://global.discourse-cdn.com/mcneel/uploads/default/original/3X/6/b/6bea5b2a6f2ffaa88bccd7b04b68a985b4cd7b95.jpeg)

---

<div class="post-metadata">

**Author:** ![AndersDeleuran](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/andersdeleuran/32/476683_2.png) [@AndersDeleuran](https://discourse.mcneel.com/u/AndersDeleuran)\
**Post date:** [April 17, 2020, 7:34am UTC](https://discourse.mcneel.com/t/importing-ironpython-libraries/100288/4 "2020-04-17T07:34:50Z")

</div>

> [@D.Ronald](#):
>
> I don’t get the intellisense option to import

The intellisense is [named intelliclunk in Rhino](https://discourse.mcneel.com/t/issue-with-python-editor/84974/11) for a good reason 😉 But just because a module doesn’t show up on `import` doesn’t mean you can’t use it. Unfortunately the `help("modules")` method doesn’t work in IronPython for listing all available Python modules. But you could do something like this to get an overview (note that this won’t list the available .NET libraries):

 ![2020-04-17 09_31_25-Grasshopper - 200417_GHPython_GetIronPythonModules_00_](https://global.discourse-cdn.com/mcneel/uploads/default/original/3X/1/0/108d2a42ab832f897edf7db7d33cd13c067c09dc.png)

[200417\_GHPython\_GetIronPythonModules\_00.gh](https://discourse.mcneel.com/uploads/short-url/6ubcLEFKMOet5B2lElUmRPRyTHv.gh) (4.6 KB)

> [@D.Ronald](#):
>
> - I cannot check the dir(urllib)
> - I cannot import the long list of IronPython modules

Can you post a screenshot of the error messages that you get?

---

<div class="post-metadata">

**Author:** ![D.Ronald](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/d.ronald/32/441716_2.png) [@D.Ronald](https://discourse.mcneel.com/u/D.Ronald)\
**Post date:** [April 17, 2020, 9:32am UTC](https://discourse.mcneel.com/t/importing-ironpython-libraries/100288/5 "2020-04-17T09:32:07Z")

</div>

Anders

Thank you so much for the help. Your script works well to expose 235 modules from IronPython. I actually don’t get any errors anywhere… it’s just all blank. Sadly my Rhino V7 has the same problems.

However, I then did this test with `urllib2` in the ghPython component and it worked:

```auto
import urllib2
print dir(urllib2)

response = urllib2.urlopen('http://www.maketank.org/')
html = response.read()
print html

```

I guess this built-in Rhino python editor isn’t a helpful Intellisense. I’ve tried to setup other IDEs and Intellisense on windows but it’s been a terrible process. What do you used for an IDE? **Any recommendations** for an IDE where I can use a better intellisense? I really need it to be complete and work well.

Thanks, Darrel

---

<div class="post-metadata">

**Author:** ![AndersDeleuran](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/andersdeleuran/32/476683_2.png) [@AndersDeleuran](https://discourse.mcneel.com/u/AndersDeleuran)\
**Post date:** [April 17, 2020, 10:04am UTC](https://discourse.mcneel.com/t/importing-ironpython-libraries/100288/6 "2020-04-17T10:04:10Z")

</div>

> [@D.Ronald](#):
>
> I guess this built-in Rhino python editor isn’t a helpful Intellisense.

It isn’t entirely useless, one just have to be aware of the limitations. When you `import` a module it will generally autocomplete when you invoke the import name. Also, if the type is known by the editor (e.g. when inputting something in GHPython and using dot notation directly on the input parameter name) autocomplete will generally work.

> [@D.Ronald](#):
>
> What do you used for an IDE?

I actually just use the GHPython editor when developing for and in Rhino/Grasshopper. And then Sublime Text when doing CPython stuff outside of Rhino. I try not to rely on intellisense in general when writing Python code, and instead use features of the language for introspection (see [here](https://discourse.mcneel.com/t/code-completion-for-ghpythonlib-components-node-in-code-in-visual-studio/43422/16) and [here](https://discourse.mcneel.com/t/c-learning-doubt/78213/68)). I also usually have e.g. t[he RhinoCommon API docs](https://developer.rhino3d.com/api/RhinoCommon/html/R_Project_RhinoCommon.htm) open, and whatever else I’m implementing.

> [@D.Ronald](#):
>
> **Any recommendations** for an IDE where I can use a better intellisense? I really need it to be complete and work well.

In that case, I would probably consider dropping down to C# and installing Visual Studio. But again, that depends a bit on your development requirements (i.e. are you developing a full-fledged plugin, just making some small scripts here and there etc.).

---

<div class="post-metadata">

**Author:** ![D.Ronald](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/d.ronald/32/441716_2.png) [@D.Ronald](https://discourse.mcneel.com/u/D.Ronald)\
**Post date:** [April 17, 2020, 6:35pm UTC](https://discourse.mcneel.com/t/importing-ironpython-libraries/100288/7 "2020-04-17T18:35:42Z")

</div>

Anders

One last reply I guess. I’ve added a modified version of the .py and .gh script [here in my Github repo](https://github.com/DarrelRonald/RhinoPythonScripts) called GetIronPythonModules. The readme explains the scripts.

- Yes, the intellisense seems to start working after an import.
- I also have the RhinoCommon and Rhinoscriptsyntax open too, but really need the help of intellisense
- I really want to avoid C# since I mostly script for Grasshopper at the moment. I don’t like the class focus, verbose structure and type requirements of C#.

Thanks. Darrel

---

<div class="post-metadata">

**Author:** ![AndersDeleuran](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/andersdeleuran/32/476683_2.png) [@AndersDeleuran](https://discourse.mcneel.com/u/AndersDeleuran)\
**Post date:** [April 17, 2020, 7:07pm UTC](https://discourse.mcneel.com/t/importing-ironpython-libraries/100288/8 "2020-04-17T19:07:59Z")

</div>

I hear you, you might also want to give this a go:

> [@Autocomplete while editing python scripts outside of Rhino](https://discourse.mcneel.com/t/autocomplete-while-editing-python-scripts-outside-of-rhino/79329):
>
> Here’s a way to get autocomplete on both Windows and Mac for editing python scripts that use RhinoCommon and Grasshopper.
