Jump to content

writing to stdout using a python node


Recommended Posts

Hello

I'm sending alembic rops to hqueue and there's a lot of preroll. Even with alfred-style progress turned on, I have no feedback on what's going on.

I was thinking that I could add a python node to write to the stdout (which I though would show up in the hqueue logs) like so:

     import sys
     f= hou.frame()
     sys.stdout.write('frame: '+str(f) + '\n')

But it doesn't work. Any ideas ?

When I start houdini with the -foreground option (so that the shell it launches from doesn't spawn a new process and should receive outputs) and write to stdout, it only shows up in the python console

 

Thanks

Link to comment
Share on other sites

Hey,

I had the same problem with Tractor. Here's what worked for me in the end (no warranty that it also works with hqueue).

The script is run as a post-frame-script in the alembic rop.

import sys

start = hou.node(".").parm("f1").eval()
end = hou.node(".").parm("f2").eval()
current = hou.frame()

progress = str(int(hou.hmath.fit(current, start, end, 0.0, 100.0))).zfill(3)

print("\rFrame {0} done".format(current))
print("\rALF_PROGRESS {0}%".format(progress))
sys.stdout.flush()

It seems that both the carriage returns AND the flushing are necessary. If any of this is missing I will only get the information in the log when the whole caching process is done.

Hope this helps,

Dennis

Edited by dennis.albus
  • Like 1
Link to comment
Share on other sites

13 minutes ago, dennis.albus said:

Hey,

I had the same problem with Tractor. Here's what worked for me in the end (no warranty that it also works with hqueue).

The script is run as a post-frame-script in the alembic rop.


import sys

start = hou.node(".").parm("f1").eval()
end = hou.node(".").parm("f2").eval()
current = hou.frame()

progress = str(int(hou.hmath.fit(current, start, end, 0.0, 100.0))).zfill(3)

print("\rFrame {0} done".format(current))
print("\rALF_PROGRESS {0}%".format(progress))
sys.stdout.flush()

 

Hope this helps,

Dennis

Thanks for the snippet, it actually works in hqueue now, even the simple print, in a python node (instead of the alembic rop which only fires when a frame is written, not during preroll).

My problem was that my python node was after the dopnet which was simulating, so it never fired during preroll. Silly me.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...