calling hython from script and get the processed data

   2866   1   0
User Avatar
Member
18 posts
Joined: Aug. 2013
Offline
I have a script named A which invokes hython like this

subprocess.call('path to the hython command'+' '+'path to script B'+' '+'path to hip file')
what script B contains is:
import sys
args = sys.argv
print args
try:
  hou.hipFile.load( args[1] )
except hou.LoadWarning, e:
  print e
renders = hou.node('/out').allSubChildren()
so the basic idea is to use hython to open a scene, process it, and get some info back(in my case,“renders”).
so how to get data back from subprocess.call or are there other ways to do so?

Any ideas would be appreciated !
Edited by WhimmY - Dec. 6, 2016 06:37:05
User Avatar
Member
2531 posts
Joined: June 2008
Offline
You can look into using POpen instead [stackoverflow.com]. This way you get a handle and can create a polling loop to review response from the spawned process. However, the app that you launch has to have been written to provide such feedback. Some apps, such as render engines, have a parameter you supply on launch that will trigger progress feedback information as the process runs.
Using Houdini Indie 20.0
Windows 11 64GB Ryzen 16 core.
nVidia 3050RTX 8BG RAM.
  • Quick Links