Hello!
In our hdas, we have Python scripts.
Some of them are logging infos thank to the python logging system.
In Houdini, everything is working fine and the output is output in the Houdini Console.
Is it possible to get these output and to display them somewhere else when you are using the hdas in HoudiniEngine?
Thanks!
How to get Python output fron Houdini Engine
6062 9 3- Francois Devic
- Member
- 44 posts
- Joined: July 2017
- Offline
- Olaf Finkbeiner
- Member
- 323 posts
- Joined: Jan. 2015
- Online
- Francois Devic
- Member
- 44 posts
- Joined: July 2017
- Offline
- chrisgreb
- Member
- 603 posts
- Joined: Sept. 2016
- Offline
- Francois Devic
- Member
- 44 posts
- Joined: July 2017
- Offline
- chrisgreb
- Member
- 603 posts
- Joined: Sept. 2016
- Offline
- Francois Devic
- Member
- 44 posts
- Joined: July 2017
- Offline
chrisgrebWe are not in UE4
The UE4 part would take some work - you'd have to have to write a custom editor plugin that watches for new houdini log messages and enters them into the UE4 logging system. Maybe there's an easy way to do it with a Blutility or the python plugin.
I was wndering how to hook ourselves to some place where the new houdini log messages are generated.
- chrisgreb
- Member
- 603 posts
- Joined: Sept. 2016
- Offline
Ah, I misread - you could add this to your scripts/123.py file like:
Except instead of a normal logging.StreamHandler, you would use your own handler that can forward the messages appropriately.
import logging handler = logging.StreamHandler(sys.stdout) logger = logging.getLogger() logger.addHandler(handler)
Except instead of a normal logging.StreamHandler, you would use your own handler that can forward the messages appropriately.
- Francois Devic
- Member
- 44 posts
- Joined: July 2017
- Offline
chrisgrebOk!
Ah, I misread - you could add this to your scripts/123.py file like:import logging handler = logging.StreamHandler(sys.stdout) logger = logging.getLogger() logger.addHandler(handler)
Except instead of a normal logging.StreamHandler, you would use your own handler that can forward the messages appropriately.
It is what I wanted to avoid
Thanks for your help
- LithLoren
- Member
- 13 posts
- Joined: June 2018
- Offline
You can redirect the console output form the HARS process using pipes:
https://docs.microsoft.com/en-us/windows/desktop/ProcThread/creating-a-child-process-with-redirected-input-and-output [docs.microsoft.com]
Just keep in mind your python scripts may need to manually flush the output buffers to get the output to show up:
https://stackoverflow.com/questions/230751/how-to-flush-output-of-print-function [stackoverflow.com]
https://docs.microsoft.com/en-us/windows/desktop/ProcThread/creating-a-child-process-with-redirected-input-and-output [docs.microsoft.com]
Just keep in mind your python scripts may need to manually flush the output buffers to get the output to show up:
https://stackoverflow.com/questions/230751/how-to-flush-output-of-print-function [stackoverflow.com]
-
- Quick Links