Custom code in .hip file throw errors before startup scripts have had a chance to add needed libraries to the Python Path.

   1572   4   2
User Avatar
Member
183 posts
Joined: Dec. 2011
Offline
The title says it all. I have a .hip file containing nodes with code that relies on external libraries to run. In my 123.py and 456.py files I handle loading the needed libraries into the environment, however since the scene file will load into memory before the startup scripts run, I get a bunch of nasty errors. The scene will still work fine once the UI opens up, but the errors tend to scare the artists.

The only way I know to work around this is to either permanently add the libraries to the system environment, or launch Houdini from a script that initialized the environment beforehand.

The problem with approach 1 is that IT doesn't want me screwing around with the system environment.

The problem with approach 2 is that I can't figure out how to do this and still allow artists to open files via double-clicking the .hip.

Any ideas? Perhaps just letting the error's happen is the lesser evil?
User Avatar
Member
1904 posts
Joined: Nov. 2006
Offline
I would look at using Houdini's pythonrc.py file to load anything you need at startup time. Those files get run when Python itself initializes and is not dependent on scene file loading
Graham Thompson, Technical Artist @ Rockstar Games
User Avatar
Member
7737 posts
Joined: Sept. 2011
Online
NFX
launch Houdini from a script that initialized the environment beforehand.
Yes.

NFX
open files via double-clicking the .hip.
No, that's not a thing.
User Avatar
Member
183 posts
Joined: Dec. 2011
Offline
Well that was a detailed response jsmake

Thanks graham, I was wondering if that could be used that way. I would really love to keep the ability to launch Houdini directly from the file.
User Avatar
Member
183 posts
Joined: Dec. 2011
Offline
The pythonrc method worked like a charm! Thanks graham!
  • Quick Links