Placing scripts for mantra python filter

   1104   3   0
User Avatar
Member
53 posts
Joined: 7月 2013
Offline
I was unable to find a hint where I have to place the scripts for the "mantra -P pythonscript.py" filter functionality. It works fine with an absolute path, but I'd prefer to place it in a more common place in the PYTHONPATH. So where exactly does mantra search for the script?
User Avatar
Member
1906 posts
Joined: 11月 2006
Offline
I don't think it will work without an absolute path as it's essentially read/executed like a script and not imported in the standard Python way. Depending on how you're formulating your mantra command you could try putting it somewhere on the HOUDINI_PATH and then finding the script as a relative path via hou.findFile:
pyfilter_path = hou.findFile("pyfilter/ht-pyfilter.py")
mantra_command = "mantra -P {}".format(pyfilter_path)
Graham Thompson, Technical Artist @ Rockstar Games
User Avatar
Member
53 posts
Joined: 7月 2013
Offline
Ah, okay. Thanks thanks a lot. This will help... and it seems that placing the file in the HOUDINI_PATH works without the absolute path.
Edited by haggi krey - 2021年8月25日 02:36:05
User Avatar
Member
1906 posts
Joined: 11月 2006
Offline
Ah, that's cool it will work just being in the HOUDINI_PATH without needing the absolute path. Can't believe I never tried that. Cheers!
Graham Thompson, Technical Artist @ Rockstar Games
  • Quick Links