Where do you store python modules when you don't have access to $HFS or /usr/lib/?

   1496   1   0
User Avatar
Member
319 posts
Joined:
Offline
Hello,

I am creating a shelf tool that sources a custom python module. Is there anywhere to store said module that Houdini will automatically pick up when using import other than/lib or /usr/lib/? I don't have write access to these directories.

I know I can add a custom directory to $LD_LIBRARY_PATH, but if I want to distribute the tool to other users they will have to do the same. Is there a directory within ~/HoudiniX.Y/ somewhere where it would get sourced automatically? I tried ~/HoudiniX.Y/scripts/ but no go, even though this directory works for sourcing other Python files, like OnCreated.py for when you place a node.

Thanks!
User Avatar
Member
319 posts
Joined:
Offline
Ok seems I have the wrong env variable. I should be using $PYTHONPATH, I mis-understood one of the helpcards!

I also found out how to do it on the fly, I'm sure lots of people already know but just in case any don't you can add this to your tool script before it tries to source the module:-

import sys
sys.path.insert(0,“/path/to/my/awesome/script”)

and your tool will see your module.
  • Quick Links