Travis Saul

plobnop

About Me

EXPERTISE
Technical Director
INDUSTRY
Gamedev

Connect

LOCATION
United States
WEBSITE

Houdini Skills

Availability

Not Specified

Recent Forum Posts

Houdini Packages, Subprocess, and duplicate env vars Aug. 22, 2022, 7:02 a.m.

Thanks for the link tamte. I've been using the info on that page for all along. I'm beginning to wonder if this is a bug. If I remove the houdini_os expression I no longer get a duplication of my env var values. Either this is a bug or I'm still not getting the syntax correct in my package.

WORKS (does not duplicate var value):
{
    "enable": true,
    "load_package_once": true,
    "env": [
        {
            "var": "MYENVVAR1",
            "value": "C:/Users/me/some/path",
            "method": "replace"
        },
        {
            "var": "MYENVVAR2",
            "value": "C:/Users/me/some/other/path",
            "method": "replace"
        }
    ]
}
os.environ result:
MYENVVAR1:C:/Users/me/some/path
MYENVVAR2:C:/Users/me/some/other/path
Does NOT work (duplicates var value):
{
    "enable": true,
    "load_package_once": true,
    "env": [
        {
            "var": "MYENVVAR1",
            "value": [
                {
                    "houdini_os == 'windows'": "C:/Users/me/some/path",
                    "method": "replace"
                },
            ]
        },
        {
            "var": "MYENVVAR2",
            "value": [
                {
                    "houdini_os == 'windows'": "C:/Users/me/some/other/path",
                    "method": "replace"
                },
            ]
        }
    ]
}
os.environ result:
MYENVVAR1:C:/Users/me/some/path;C:/Users/me/some/path
MYENVVAR2:C:/Users/me/some/other/path;C:/Users/me/some/other/path

Houdini Packages, Subprocess, and duplicate env vars Aug. 21, 2022, 4:39 p.m.

It's strange. I've tried setting both of these in my package and I'm still getting a double loading of the environment variables.

Houdini Packages, Subprocess, and duplicate env vars Aug. 21, 2022, 2:32 p.m.

I have an issue and I'm curious if any of you have any solutions. I've set some environment variables via a package located in a custom directory set via HOUDINI_PACAGE_DIR. When I run Houdini the variable load find and there are no issues. However, for purposes of publishing on a pipeline, I am using subprocess within a python script to copy, open, and execute some rops within a hip files. The strange thing is, the values of the env vars I've set within that package are doubled or a copy of that values is appended. MYENV1 would normally have a values of "C:/Users/me/some/path". When accessed from within a Houdini hip file opened via subprocess it has a value of "C:/Users/me/some/path;C:/Users/me/some/path". Additionally, this behavior does not happen if I set the environment variables via houdini.env.

I'm not sure how to prevent this from happening. Any thoughts?

Here's the simple package json I was using:
{
    "enable": false,
    "env": [
        {
            "MYENV1": [
                {
                    "houdini_os == 'windows'": "C:/Users/me/some/path"
                },
                {
                    "houdini_os == 'macos'": "/Users/me/some/path"
                }
            ]
        },
        {
            "MYENV2": [
                {
                    "houdini_os == 'windows'": "C:/Users/me/some/other/path"
                },
                {
                    "houdini_os == 'macos'": "/Users/me/some/other/path"
                }
            ]
        }
    ]
}