I'm trying to have a setup where python modules are automatically loaded from $JOB directory.
I tried putting them in $JOB/scripts or $JOB/python2.7libs.
Tried setting up $JOB/scripts/123.py and 456.py with sys.path setup done by hand but even those scripts don't seem like they are run.
I cannot even import them by hand in python shell.
Looks like $JOB/ paths are completely ignored.
I setup $JOB with File/Set Project.
I confirm that it worked by running hou.expandString(“$JOB”) in python shell. (Which outputs correct path).
I saved scene, opened it again. Tried opening new scenes with project setup(thinking that this will maybe finally call 456.py in $JOB/scripts).
Am I missing something? Isn't this supposed to work?
I'm using Houdini FX Version 17.5.360 LC
Loading python modules from $JOB directory.
1412 2 1-
- danielkrakowiak
- Member
- 2 posts
- Joined: June 2018
- Offline
-
- toadstorm
- Member
- 405 posts
- Joined: April 2017
- Offline
Adding paths on disk to sys.path isn't the same as adding something to the PYTHONPATH variable in the environment containing Houdini. It only works for the local shell that you run the command in.
The behavior you're looking for is typically handled by a launcher that configures the local environment before running Houdini, or by something like Rez that can help configure environment variables as well as other dependencies per-project.
The behavior you're looking for is typically handled by a launcher that configures the local environment before running Houdini, or by something like Rez that can help configure environment variables as well as other dependencies per-project.
MOPs (Motion Operators for Houdini): http://www.motionoperators.com [www.motionoperators.com]
-
- danielkrakowiak
- Member
- 2 posts
- Joined: June 2018
- Offline
I'm setting paths by adding them to sys.path in python source editor for some of my hip files so I assumed that this could work for 123.py scripts as well.
Ideal behavior I'm looking for is for houdini to just find and add python2.7libs folder automatically when found in $JOB. I've seen some forum post which suggest that this is something that works, but those post are old. Maybe it got changed, or they were wrong.
Guess I'll add a launcher then.
EDIT:
Scripts and modules from HSITE do load as I want them to.
I still want to have those python modules as project dependent not site dependent.
So I extend sys.path manually by adding $JOB/python2.7libs with HSITE/scripts/456.py and now it works.
Still, wish this was default behavior.
Ideal behavior I'm looking for is for houdini to just find and add python2.7libs folder automatically when found in $JOB. I've seen some forum post which suggest that this is something that works, but those post are old. Maybe it got changed, or they were wrong.
Guess I'll add a launcher then.
EDIT:
Scripts and modules from HSITE do load as I want them to.
I still want to have those python modules as project dependent not site dependent.
So I extend sys.path manually by adding $JOB/python2.7libs with HSITE/scripts/456.py and now it works.
Still, wish this was default behavior.
Edited by danielkrakowiak - Nov. 24, 2019 04:49:33
-
- Quick Links

