Jump to content

where to store a houdini python script?


Recommended Posts

Hi,

If I type : hou.houdiniPath(), I get for example : "/dir1",

- If I place myScript.py directly in "/dir1", it load successfully in Houdini

- If I place myScript.py in "/dir1/scripts", then it won't load in Houdini

- If I place myScript.py in "/dir1/python2.7libs", then it will still be loaded

my question: is the folder name "python2.7libs" standard? can I use other name or I must place all my scripts inside python2.7libs?

Thanks,

Link to comment
Share on other sites

If you want the code to travel with the HIP file you can paste or type your code into the Python Source Editor. If your code is more tool like you can make your own button on your own shelf and paste or type your code into the Script tab. More often I will simply drop down a Python node at the root or inside a SOP, depending upon what the code needs to do.

One advantage to placing code inside it's own Python node is that you now have a named container that you can force cook, if necessary. Any time I use Python to drive animation I have found I have to force cook the Python node on export in order to advance the animation through time.

Edited by Atom
  • Like 1
Link to comment
Share on other sites

Ditto to what Atom said.

In generally I put the python scripts in the "\scripts\python" of any of the HOUDINI_PATH, or other environment variable based python re-directs. I can't say it's 100% standard, but this has been common for me at many studios. Plus any directory you place inside the python folder for organization sake, make sure to have the __init__.py script in there. Generally the only python scripts I have at the "\scripts\" level are the standard Houdini based overrides i.e. 123.py, 456.py, hescape.py. 

  • Like 2
Link to comment
Share on other sites

Thank you guys...

I've looked at my environment variable, but could not find any thing related to python! I just found:

HOUDINI_ROOT=/studio/a/b/houdini/15.5.523.2
HOUDINI_BASE=/studio/a/b/houdini/15.5.523.2
HOUDINI_VERSION=15.5.523.2

I am not sure why "scripts/python" is not there...

 

Link to comment
Share on other sites

You have to personally set $HOUDINI_PATH as a system environment variable. It does not automatically get created, by default it will only reference your $HOME directory. In either case you will need to manually create the scripts/python directory in the respective directory.

an example would be $HOUDINI_PATH = z:/projects/1234_asuscommercial/projectResources/houdini/

and then within that directory, add /scripts/python

  • Like 3
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...