Grasshopper

algorithmic modeling for Rhino

Dear All,

Somehow I am unable to import the utility module

import utility
Runtime error (ImportException): No module named utility

without to show the hole patch to utility.py, is that normal?

Thanks,
Dimitry

Views: 1558

Replies to This Discussion

Hi Dimitry,

utility is not a standard library module, right?

GhPython uses the same resolution as _EditPythonScript and Rhino. It instructs the runtime to look at the very same places. You can see them inside Tools, then Options (see image on the right). 

Nevertheless, are you meaning that you have the Grasshopper file and Python module in the same folder and would like to maintain the link relatively? This sample shows how to, using the sys module.

Cheers,

- Giulio
_______________
giulio@mcneel.com

Attachments:

Btw, there is an item in the issues about this. There is a good chance that we will decide to add the local path to the sys.path list automatically. This, however, might have some implications when several components execute in different documents.

For now, please use the method above.
Thanks,

- Giulio
________________
giulio@mcneel.com

Hi Giulio,

Do you maybe how to solve the next problem with the importing libraries? I am importing networkx, but an error raises, the decorator module is not founded. But the same script works from the command line. 

Thanks in advance.

Dimitry

Hi Giulio,

Thank you for the helpful reply! 

Cheers,

Dimitry

RSS

About

Translate

Search

Photos

  • Add Photos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service