# Rhino 8 Script Editor Python Module Search Path missing

**URL:** <https://discourse.mcneel.com/t/rhino-8-script-editor-python-module-search-path-missing/171317>\
**Category:** Rhino\
**Tags:** windows\
**Created:** [December 12, 2023, 1:52pm UTC](https://discourse.mcneel.com/t/rhino-8-script-editor-python-module-search-path-missing/171317 "2023-12-12T13:52:05Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![daniel.kowollik](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/daniel.kowollik/32/632629_2.png) [@daniel.kowollik](https://discourse.mcneel.com/u/daniel.kowollik)\
**Post date:** [December 12, 2023, 1:52pm UTC](https://discourse.mcneel.com/t/rhino-8-script-editor-python-module-search-path-missing/171317/1 "2023-12-12T13:52:05Z")

</div>

I am testing our python Rhino 7 packages in Rhino 8 and I wanted to try the new Script Editor. Am I missing something? The old Rhino Python Editor (IronPython) has the possibility to add module search pathes within the Tools/Options pop up menu. This is also still available in Rhino 8. Where do I find a menu in the new Script Editor to add module search pathes for IronPython (Python 2) and CPython (Python 3)?  
All my python code and Rhino Python Commands are organized in python native packages. I do not want to use sys.path.append or extend to add these pathes to all the run scripts.

---

<div class="post-metadata">

**Author:** ![daniel.kowollik](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/daniel.kowollik/32/632629_2.png) [@daniel.kowollik](https://discourse.mcneel.com/u/daniel.kowollik)\
**Post date:** [December 12, 2023, 1:59pm UTC](https://discourse.mcneel.com/t/rhino-8-script-editor-python-module-search-path-missing/171317/3 "2023-12-12T13:59:29Z")

</div>

Ok, I found this comment in an iron python snipped.

```auto
- Use env directive to add an environment path to sys.path automatically
    # env: /path/to/your/site-packages/

```

It seems to work, but where does Rhino put this? This seems to be global, because I can use it in other scripts as well. Is there a configuration file that I can change afterwards?

---

<div class="post-metadata">

**Author:** ![eirannejad](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/eirannejad/32/775509_2.png) [@eirannejad](https://discourse.mcneel.com/u/eirannejad)\
**Post date:** [December 12, 2023, 6:28pm UTC](https://discourse.mcneel.com/t/rhino-8-script-editor-python-module-search-path-missing/171317/4 "2023-12-12T18:28:11Z")

</div>

@daniel.kowollik Hi Daniel  
There are no configs at the moment. The `env` directive adds that to the IronPython engine (which technically runs other scripts as well so it is global currently, but not guranteed to stay like this)

I can add options in the new editor to add these default search paths if that’s what you need

---

<div class="post-metadata">

**Author:** ![clement](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/clement/32/772979_2.png) [@clement](https://discourse.mcneel.com/u/clement)\
**Post date:** [December 12, 2023, 6:55pm UTC](https://discourse.mcneel.com/t/rhino-8-script-editor-python-module-search-path-missing/171317/5 "2023-12-12T18:55:29Z")

</div>

> [@eirannejad](#):
>
> it is global currently, but not guranteed to stay like this

Hi @eirannejad, if this is not going to stay as it has been over the last years than it potentionally will break all scripts which can be started from a button command without hardcoded paths to the script. Eg. say you have organized your workspace with buttons having this as a macro:

`! _-RunPythonScript MyScriptName.py`

And you have defined the path to a folder containing your scripts under Tools/Options/Search Paths, then these buttons all will not work anymore.

I often publish larger packages of uncompiled scripts with a workspace (rui) file. All the user needs to do to “install” the package is to define the Search Path to the location he extracted the package to. So i hope you will not abandon that useful concept of defining global search paths for scripts and modules.  
\_  
c.

---

<div class="post-metadata">

**Author:** ![eirannejad](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/eirannejad/32/775509_2.png) [@eirannejad](https://discourse.mcneel.com/u/eirannejad)\
**Post date:** [December 12, 2023, 7:07pm UTC](https://discourse.mcneel.com/t/rhino-8-script-editor-python-module-search-path-missing/171317/6 "2023-12-12T19:07:46Z")

</div>

Okay I added this ticket and will get that implemented ASAP

[RH-79027](https://mcneel.myjetbrains.com/youtrack/issue/RH-79027) Add Rhino options search paths to Python engines

---

<div class="post-metadata">

**Author:** ![daniel.kowollik](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/daniel.kowollik/32/632629_2.png) [@daniel.kowollik](https://discourse.mcneel.com/u/daniel.kowollik)\
**Post date:** [December 13, 2023, 1:07pm UTC](https://discourse.mcneel.com/t/rhino-8-script-editor-python-module-search-path-missing/171317/7 "2023-12-13T13:07:13Z")

</div>

Hi, sounds great. Are you going to add this for IronPython and CPython?

---

<div class="post-metadata">

**Author:** ![daniel.kowollik](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/daniel.kowollik/32/632629_2.png) [@daniel.kowollik](https://discourse.mcneel.com/u/daniel.kowollik)\
**Post date:** [December 13, 2023, 1:22pm UTC](https://discourse.mcneel.com/t/rhino-8-script-editor-python-module-search-path-missing/171317/8 "2023-12-13T13:22:57Z")

</div>

It would be great to have a user specific config file (for example JSON or YAML). You can add the GUI feature like in the old Editor and one would be able to write or edit this config file with other tools as well. We usually use a hidden config file in the home directory for our toolchains.

I found out that Rhino 8 uses the Windows PYTHONPATH variable and adds the entries to the cpython search path. This setup could lead to conflicts, if one uses another system wide cpython distribution and packages that are not available in Rhino 8 or provide a different version of the identical package.

---

<div class="post-metadata">

**Author:** ![eirannejad](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/eirannejad/32/775509_2.png) [@eirannejad](https://discourse.mcneel.com/u/eirannejad)\
**Post date:** [December 14, 2023, 6:02pm UTC](https://discourse.mcneel.com/t/rhino-8-script-editor-python-module-search-path-missing/171317/9 "2023-12-14T18:02:13Z")

</div>

@daniel.kowollik  
Language specific module search paths coming in Rhino 8.4 RC  
I’ll document this on developer docs and will share

![Rhino_84I72pAQ0c](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/2/7/f/27fa08cd9af31ef653f2c231d16ab83fc23cf461.png)

---

<div class="post-metadata">

**Author:** ![daniel.kowollik](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/daniel.kowollik/32/632629_2.png) [@daniel.kowollik](https://discourse.mcneel.com/u/daniel.kowollik)\
**Post date:** [December 15, 2023, 8:03am UTC](https://discourse.mcneel.com/t/rhino-8-script-editor-python-module-search-path-missing/171317/10 "2023-12-15T08:03:28Z")

</div>

@eirannejad looks great. Thank you, this will help a lot.

---

<div class="post-metadata">

**Author:** ![vincentfs](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/vincentfs/32/496894_2.png) [@vincentfs](https://discourse.mcneel.com/u/vincentfs)\
**Post date:** [January 22, 2024, 4:48pm UTC](https://discourse.mcneel.com/t/rhino-8-script-editor-python-module-search-path-missing/171317/11 "2024-01-22T16:48:06Z")

</div>

Hi @eirannejad ,

When will 8.4 RC be available? Like Clement did, over last decade, I’ve been relying on “Module Search Paths” functionality to create uncompiled packages. Until there is a better workaround, it would be cumbersome for many users to shift from the old workflow.

Best,  
Vincent

---

<div class="post-metadata">

**Author:** ![clement](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/clement/32/772979_2.png) [@clement](https://discourse.mcneel.com/u/clement)\
**Post date:** [January 22, 2024, 4:51pm UTC](https://discourse.mcneel.com/t/rhino-8-script-editor-python-module-search-path-missing/171317/13 "2024-01-22T16:51:32Z")

</div>

> [@vincentfs](#):
>
> When will 8.4 RC be available?

Hi Vincent, it is already there to download if you set it like below:

 ![grafik](https://global.discourse-cdn.com/mcneel/uploads/default/original/4X/c/9/e/c9e5fd69d45a011876c2002bdc8777d4be3cf40d.png)  
\_  
c.

---

<div class="post-metadata">

**Author:** ![vincentfs](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/vincentfs/32/496894_2.png) [@vincentfs](https://discourse.mcneel.com/u/vincentfs)\
**Post date:** [January 22, 2024, 7:24pm UTC](https://discourse.mcneel.com/t/rhino-8-script-editor-python-module-search-path-missing/171317/14 "2024-01-22T19:24:52Z")

</div>

Ok, I managed to upgrade to RC8.4. But when I do `! _-RunPythonScript Module/Script.py`. It still cannot find the script in the search paths? (the path is added and rhino restarted)

Am I missing some steps? @clement

---

<div class="post-metadata">

**Author:** ![eirannejad](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/eirannejad/32/775509_2.png) [@eirannejad](https://discourse.mcneel.com/u/eirannejad)\
**Post date:** [January 22, 2024, 7:53pm UTC](https://discourse.mcneel.com/t/rhino-8-script-editor-python-module-search-path-missing/171317/15 "2024-01-22T19:53:12Z")

</div>

Right now you need to add the paths to the search paths in the new editor

> [@Rhino 8 Script Editor Python Module Search Path missing](https://discourse.mcneel.com/t/rhino-8-script-editor-python-module-search-path-missing/171317/9):
>
> @daniel.kowollik Language specific module search paths coming in Rhino 8.4 RC I’ll document this on developer docs and will share [Rhino\_84I72pAQ0c]

but tomorrows 8.4 build has a few more paths automatically added to the search paths. Notably the `scripts` path in Rhino app data directory.

@vincentfs Where is `Module/script.py` located?

---

<div class="post-metadata">

**Author:** ![clement](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/clement/32/772979_2.png) [@clement](https://discourse.mcneel.com/u/clement)\
**Post date:** [January 22, 2024, 7:57pm UTC](https://discourse.mcneel.com/t/rhino-8-script-editor-python-module-search-path-missing/171317/16 "2024-01-22T19:57:21Z")

</div>

> [@vincentfs](#):
>
> But when I do `! _-RunPythonScript Module/Script.py`. It still cannot find the script

Hi @vincentfs, i guess it should be like this:

```python
! _-RunPythonScript Script.py

```

then define the full path to `Module` in the searchpaths for the new script editor under

> Tools \> Options \> IronPython 2

\_  
c.

---

<div class="post-metadata">

**Author:** ![eirannejad](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/eirannejad/32/775509_2.png) [@eirannejad](https://discourse.mcneel.com/u/eirannejad)\
**Post date:** [January 22, 2024, 9:28pm UTC](https://discourse.mcneel.com/t/rhino-8-script-editor-python-module-search-path-missing/171317/17 "2024-01-22T21:28:04Z")

</div>

Added path file to docs. Tomorrow’s 8.4 RC will include these changes

[https://developer.rhino3d.com/guides/scripting/editor-configs/](https://developer.rhino3d.com/guides/scripting/editor-configs/)

---

<div class="post-metadata">

**Author:** ![vincentfs](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/vincentfs/32/496894_2.png) [@vincentfs](https://discourse.mcneel.com/u/vincentfs)\
**Post date:** [January 23, 2024, 3:26am UTC](https://discourse.mcneel.com/t/rhino-8-script-editor-python-module-search-path-missing/171317/18 "2024-01-23T03:26:03Z")

</div>

My folder is structured like this:

```auto
/search/path/
* module1 folder
* - script11.py
* - script12.py
* module2 folder
* - script21.py
* - script22.py

```

The method I used worked very well across Rhino 5,6,7. I think this is a better workflow in terms of namespace management than putting all scripts directly under one search path. At least when you start a new module, you don’t need to add module folder to search path again.

-----edited:  
I tried to put the script directly under search path, and do `! _-RunPythonScript Script.py` without module folder prefix. It didn’t respond either. I’m not sure whether the method works on other computer. Or am I missing some settings for the python engine? I’m running on (8.4.24016.19001, 2024-01-16).

Another question is, for command line “RunPythonScript”, what python engine (2 vs 3) does it defaults to? Will it change depends on the hashtag line in the scripts?

Best,

---

<div class="post-metadata">

**Author:** ![vincentfs](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/vincentfs/32/496894_2.png) [@vincentfs](https://discourse.mcneel.com/u/vincentfs)\
**Post date:** [January 25, 2024, 1:43pm UTC](https://discourse.mcneel.com/t/rhino-8-script-editor-python-module-search-path-missing/171317/19 "2024-01-25T13:43:26Z")

</div>

Any updates or suggestions? @eirannejad  
Thanks!

---

<div class="post-metadata">

**Author:** ![clement](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/clement/32/772979_2.png) [@clement](https://discourse.mcneel.com/u/clement)\
**Post date:** [January 25, 2024, 4:54pm UTC](https://discourse.mcneel.com/t/rhino-8-script-editor-python-module-search-path-missing/171317/20 "2024-01-25T16:54:25Z")

</div>

> [@vincentfs](#):
>
> Another question is, for command line “RunPythonScript”, what python engine (2 vs 3) does it defaults to? Will it change depends on the hashtag line in the scripts?

Hi @vincentfs,

as far as i understand, `EditPythonScript` and `RunPythonScript` use IronPython 2.7 in Rhino 8.

\_  
c.

---

<div class="post-metadata">

**Author:** ![vincentfs](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/vincentfs/32/496894_2.png) [@vincentfs](https://discourse.mcneel.com/u/vincentfs)\
**Post date:** [January 29, 2024, 5:57am UTC](https://discourse.mcneel.com/t/rhino-8-script-editor-python-module-search-path-missing/171317/21 "2024-01-29T05:57:38Z")

</div>

Thanks @clement . I finally figured out that in order for `RunPythonScript` to work, I had to set the search path through `EditPythonScript` which is a hidden window in Rhino 8.

As a reference for anyone who is curious, by default `RunPythonScript` use IronPython2.7, but if you have `#! python 3` in the code, it will use python 3.8.

v.

---

<div class="post-metadata">

**Author:** ![eirannejad](https://sea3.discourse-cdn.com/mcneel/user_avatar/discourse.mcneel.com/eirannejad/32/775509_2.png) [@eirannejad](https://discourse.mcneel.com/u/eirannejad)\
**Post date:** [January 29, 2024, 9:01pm UTC](https://discourse.mcneel.com/t/rhino-8-script-editor-python-module-search-path-missing/171317/22 "2024-01-29T21:01:38Z")

</div>

> [@vincentfs](#):
>
> As a reference for anyone who is curious, by default `RunPythonScript` use IronPython2.7, but if you have `#! python 3` in the code, it will use python 3.8.

Python 3.9.10 to be exact

[Next page](https://discourse.mcneel.com/t/rhino-8-script-editor-python-module-search-path-missing/171317.md?page=2)
