Hou module not picking up HOUDINI_PATH

   198   3   3
User Avatar
Member
175 posts
Joined: Dec. 2011
Offline
I'm using the hou module in a custom python script. The process I am using is that I set the needed environment variables inside the python script via os.environ and add Houdini's python2.7libs folder to the sys.path before finally importing the hou module as per the documentation.

However when I load a hip file via hou.hipFile.load I get errors saying that houdini can't find some of the custom HDA's it contains. I keep these HDA's in a special folder for asset management purposes and made sure that it was included in the ‘HOUDINI_PATH’ environment variable that I set before importing hou. However, running hou.houdiniPath reveals that houdini sees the variable as set to what appears to be default values. If I then os.getenv the variable by name it does show it as being set and containing the proper folder that contains the hda/ and otl/ folders where I keep the missing assets. Confusing…

Is this a bug? Am I doing something wrong?
User Avatar
Staff
990 posts
Joined: July 2005
Offline
Hello,

It sounds like a bug. Perhaps the HOUDINI_PATH initialization isn't happening because you are running regular Python as oppose to hython or houdini.

I would suggest submitting a bug to SideFX support and attach your .hip file and script.

Cheers,
Rob
User Avatar
Member
5 posts
Joined: Jan. 2012
Offline
I haven't tried recreating this, but like Rob was saying, maybe try hou.setenv to set the HOUDINI_PATH instead of sys.path.
I'm not exactly sure of the order, but could it also be that Houdini is sourcing the HDAs before the path is updated, in which case you could try running hou.hda.reloadAllFiles() after updating the path?

Good luck!
FX TD - The Mill, Los Angeles, CA
User Avatar
Member
175 posts
Joined: Dec. 2011
Offline
Using hou.putenv() to set the ‘HOUDINI_PATH’ before loading the file seems to do the trick. Thanks for the suggestion Zephmann!

The odd thing is that hou.houdiniPath() still returns the wrong values, even though everything else works. Either way files are loading now without complaining and that is what I needed.

Also yes this was running from python with me handling initialization of the env vars and importing the hou module.
Edited by NFX - Feb. 9, 2018 20:05:13
  • Quick Links