Anton Posted November 28, 2011 Share Posted November 28, 2011 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? Quote Link to comment Share on other sites More sharing options...
graham Posted November 28, 2011 Share Posted November 28, 2011 Look at setting HOUDINI_SCRIPT_PATH. It allows you to specify directories to search for when loading scripts. Quote Link to comment Share on other sites More sharing options...
Anton Posted November 28, 2011 Author Share Posted November 28, 2011 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? Quote Link to comment Share on other sites More sharing options...
Green-Man Posted November 29, 2011 Share Posted November 29, 2011 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 Quote Link to comment Share on other sites More sharing options...
Anton Posted November 29, 2011 Author Share Posted November 29, 2011 Спасибо, Green-Man! In my case to add path to sys.path was the best way to solve this task. Quote Link to comment Share on other sites More sharing options...
Green-Man Posted November 29, 2011 Share Posted November 29, 2011 By the way I've just found on OdWiki: You might also wish to set the HOUDINI_SCRIPT_PATH variable for more control. This path is compatible with both Python and Hscript. as graham suggested. Quote Link to comment Share on other sites More sharing options...
Anton Posted December 2, 2011 Author Share Posted December 2, 2011 Thx, Green-Man, I will try both! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.