Jump to content
underscoreus

Reading .env file from a centralized directory

Recommended Posts

Hi guys!

I'm working on simplifying the setup in the computer lab at the school I work for. In that regard, I've been looking at making a centralized houdini.env file to put on our server. The best-case scenario would be if there is a variable I can enter into the local houdini.env file to tell it to look elsewhere for the rest of the config since this would give flexibility incase some local overrides are needed. Does such a variable exist?

I've had a go trying to set PATH, HOUDINI_PATH, and HOUDINI_USER_PREF_DIR to a folder on my desktop as a test but neither seemed to give the result I wanted.

Thanks for the read!

Edited by underscoreus

Share this post


Link to post
Share on other sites

In houdini.env:

HOUDINI_PATH=$HFS/houdini:/path/to/my_tools

 

where my_tools is a directory that has a structure which houdini recognises (i.e otls, scripts folders etc )

  • Like 2

Share this post


Link to post
Share on other sites

Sorry for the late reply, some other stuff came up, and had to put this project on ice for a week. I've gotten some of my setup working using a similar setup to what you suggested:
(Note that I:\ is a networked drive)

Quote

HOUDINI_PACKAGE_DIR = "I:\_pipeline\_release\Houdini\18_0\packages"
HOUDINI_PATH = "I:\_pipeline\_release\Houdini\18_0;&"

This does solve the issue (or at least some of it?) detailed in the original post. However, while Houdini now reads my custom scripts/toolbars from this folder it is unable to read the .json package files I have there. My original plan was to have another houdini.env file in this server folder with all of the variables, but after testing and finding that to not work I moved onto the package approach. Testing my .json files locally inside ".../Documents/houdini18.0/packages" they work perfectly, but when I move them to "I:/_pipeline/_release/Houdini/18_0/packages" they don't get read and any plugins like Redshift or Arnold don't get added.

If anyone's had success with this I'd love to hear from ya!

Share this post


Link to post
Share on other sites

Thanks for all of the replies!
I ended up doing something kind of similar. Since we don't adhere to a very strict pipeline system here I'm afraid making a dedicated launch script would bring the problem where students don't use it to launch Houdini, instead using the Houdini shortcut on the desktop or the start/search.

I ended up making a little function in the pythonrc.py file making sure that it copies all packages from the server to the local packages directory every time Houdini boots up, so far seems to work decently enough.

And if anyone coming to this thread in the future wants an example of what I made, here it is:

 

from shutil import copy2
import glob
from os import makedirs
from os import path
from getpass import getuser

versionNumber = hou.applicationVersionString()[0:-4]

source = r"I:/_pipeline/_release/Houdini/" + versionNumber + r"/packages"
dest = r"C:/Users/" + getuser() + r"/Documents/houdini" + versionNumber +r"/packages"

srcfiles = glob.glob(source + r"/*.json")

def wifmGetPackages():
    if path.exists(dest) == False:
        makedirs(dest)

    try:
        for f in srcfiles:
            copy2(f,dest)
    except Exception:
        print("Error in loading packages")


wifmGetPackages()

 

Share this post


Link to post
Share on other sites

Hi Martin

I wondered if you stuck with this approach or found a better way of doing it? I'm trying to figure out how to get a small number of networked machines to share package files and have been struggling with the same issues... I'll try your method above - though I'm prototyping on a single non-networked machine. Presumably shouldn't be too difficult to roll out to the others if I can get it working.

Thanks!

 

Share this post


Link to post
Share on other sites

Packages dir reads before env file, so you need to put json files in each houdini folder or use a wrapper )

Share this post


Link to post
Share on other sites

Thanks Andrii

When you say in each Houdini folder you mean on each machine?

I don't really know much about using a wrapper but I'll look into that as I'm trying to avoid maintaining all the machines' packages separately.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×