Python Question

   3502   5   2
User Avatar
Member
6 posts
Joined: June 2008
Offline
Sounds simple, but I can't seem to find any info on how to get the name of the current take with python (or hscript, for that matter). Anyone know how to go about this?

Thanks!
If life was fair, the horse would get to ride half the time.
User Avatar
Member
678 posts
Joined: July 2005
Offline
It looks that you are out of luck:
http://www.sidefx.com/docs/houdini12.0/hom/hou/Take [sidefx.com]
http://www.sidefx.com/docs/houdini12.0/hom/hou/takes [sidefx.com]
User Avatar
Member
373 posts
Joined: March 2009
Offline
according to: http://www.sidefx.com/docs/houdini12.0/commands/takeset [sidefx.com] the variable $ACTIVETAKE lists the current take. In python you should be able to do:
import os
os.getenv('ACTIVETAKE')
or something along those lines – I don't have it open to test at the moment.
Ian Farnsworth
User Avatar
Member
1906 posts
Joined: Nov. 2006
Offline
With Houdini variables, os.environ isn't reliable/useful. ACTIVETAKE kind of works given how early it is set by Houdini, however it breaks down soon afterwards. Creating a new take and switching to it will leave the value incorrect. You should use hou.expandString() instead.
>>> os.environ.get(“ACTIVETAKE”)
'Main'
>>> hou.expandString(“$ACTIVETAKE”)
'take1'
Graham Thompson, Technical Artist @ Rockstar Games
User Avatar
Member
373 posts
Joined: March 2009
Offline
Sweet, thx for the clarification. I knew there was another way to grab houdini variables, just couldn't think of it.
Ian Farnsworth
User Avatar
Member
509 posts
Joined: July 2005
Offline
graham
With Houdini variables, os.environ isn't reliable/useful. ACTIVETAKE kind of works given how early it is set by Houdini, however it breaks down soon afterwards. Creating a new take and switching to it will leave the value incorrect. You should use hou.expandString() instead.
>>> os.environ.get(“ACTIVETAKE”)
'Main'
>>> hou.expandString(“$ACTIVETAKE”)
'take1'

THANKS.this just saved my after banging my head against the screen for 2 hours!! .. what I don't understand is *why* suddenly is.environ didn't work anymore! (in my case that was the culprit variable)

but anyway… Thanks! .. now I can go home.
JcN
VisualCortexLab Ltd :: www.visualcortexlab.com
  • Quick Links