Jump to content
mathieuN

JOB variables problem with setenv

Recommended Posts

Hi Evryone,

I am currently building a Houdini pipeline in order to link it to shotgun.

Everything work well and pretty easily.

but there is a but.

I am setting the env var JOB with the command set or setenv it`s the same.

Each time I re-open the hip file my job env is not set correctly. Houdini keep the older JOB variables.

And if I do the same manip into the UI in the aliases and variables it`s work well.

 

I do not understand why.

Many there is a logic.

If anyone know please tell me.

 

 

thanks

 

mathieu

 

 

 

Share this post


Link to post
Share on other sites

I remember reading that Houdini saves the JOB env with the hip file. But it sounds like you want it to automatically update to whatever env you have set in your shell. Maybe you could add something to you 456.py to reset the JOB env. Something like this maybe.

import hou
import os
hou.putenv("JOB",os.environ["JOB"])

 

Share this post


Link to post
Share on other sites

Thanks for you reply.

But it s still doesn`t work for me.

Just to be clear, I want to change the $JOB inside my scene with using the 123.py and 456.py.

With this method I can change the context of any shots with reloading houdini.

And just to be clear, I need $JOB for HQUEUE server because without a $HIP or $JOB it doesn`t work.

I gonna continue to find a good solution for this problem.

thanks again for your reply.

 

 

 

Share this post


Link to post
Share on other sites

Setting environment variables with python from inside a running Houdini instance is messy and not working as expected.

I've had more success using the equivalent hscript commands.

hou.hscript("setenv JOB = foobar")
hou.hscript("varchange JOB") # this is optional and probably not needed in your case

Hope this will work for you.

Cheers,

Dennis

Edited by dennis.albus
  • Like 1

Share this post


Link to post
Share on other sites

Thanks dennis,

The value change when you execute the syntax, but when you re-open your scene the value is reinitialize.

 

thanks a lot

mathieu

 

 

 

Share this post


Link to post
Share on other sites

Try setting os.environ["JOB"] from Python, and then calling hou.allowEnvironmentToOverwriteVariable("JOB") before loading your .hip file.

  • Like 2

Share this post


Link to post
Share on other sites

I checked help document, it is

hou.allowEnvironmentToOverwriteVariable("JOB", True)

in houdini16

  • Like 2

Share this post


Link to post
Share on other sites

I swear I run into this problem every time I have to set up a new Houdini pipeline and it takes me twenty minutes to find this thread again. Thanks Edward and Yongbin - that's the line I'm always missing.

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

×