Jump to content

Load Python Scripts


Anton

Recommended Posts

Hi, I trying to load my python scripts from Houdini. But as I understand Houdini searchs for scripts only in:

/houdini/python2.6libs;

/houdini/python2.5libs;

/home/user/houdini11.1

The problem is that I should store all python script in my specific directory, for example: /media/WORK/python_scripts

Where I should add path to tell Houdini search for scripts in my folder? Any environment variable?

Link to comment
Share on other sites

Thx, I try to set path writing in houdini.env file string: HOUDINI_SCRIPT_PATH = /media/WORK/python_scripts but when i trying to load python file...

execfile(hou.findFile('$HOUDINI_SCRIPT_PATH/Privet.py'))

export = programma()

... i have an error

What I'm doing wrong?

Link to comment
Share on other sites

I think HOUDINI_SCRIPT_PATH is the variable for Hscripts not for Python scripts

http://www.sidefx.co..._guide#id387686

The construction:

execfile(hou.findFile('$HOUDINI_SCRIPT_PATH/Privet.py'))

wouldn't work because python wouldn't convert string "$HOUDINI_SCRIPT_PATH/Privet.py" to something like "/media/WORK/python_scripts/Privet.py"

For this script to work you should probably do something like:

execfile(hou.findFile(os.environ['HOUDINI_SCRIPT_PATH']+'/Privet.py'))

But it seems to be not very convenient. Через одно место, вобщем :)

You can set PYTHONPATH variable where python (and hython) will look for modules

http://docs.python.o...ule-search-path

Or append your favorite path to sys.path directly in your program before importing module:

import sys
sys.path.append("/media/WORK/python_scripts")
import Privet

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...