![]() ![]() If in the previous example the mylib directory is somewhere that’s not on the path you’d do something like this: mkdir /somepath/mylibĬd ~/Library/Application\ Support/McNeel/Rhinoceros/Scripts If your library is in a directory that is not under a search path you can create a link to it from /Users/NAME/Library/Application\ Support/McNeel/Rhinoceros/Scripts. You can now import your module from a script that’s in ~/py. ex: cd ~/pyĮcho "def doit(): print 'doit'" > myscript.py #simple script Let’s say your working directory is ~/py. Subdirectories need to have a _init_.py file so they are recognised as modules. That means you can’t import modules that are not under: /Users/NAME/Library/Application\ Support/McNeel/Rhinoceros/Scripts or not in the directory or a subdirectory of the file you’re currently running. One current limitation is that the python search path is not configurable. Your scripts can reside anywhere but if they are not on the search path they can’t be imported by other scripts. ![]() I’m not sure this is any better than the post I just deleted but here it goes …
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |