Python 3 - printing to console not working

   9171   7   1
User Avatar
Member
67 posts
Joined: 1月 2014
Online
Hi, I've downloaded Houdini 18.0.287 (Python 3), and for some reason I can't print to console when using a python node. Is this a known issue? any workarounds ?

thanks.

——-

EDIT: I'm actually getting some errors logged to console upon Houdini start, and middle-clicking nodes also don't show anything.

log:

Error running event handler:
File “opdef:/Sop/attribpaint?ViewerStateModule”, line 52
if basenode is not None:
^
TabError: inconsistent use of tabs and spaces in indentation

Error running event handler:
Traceback (most recent call last):
File “opdef:/Sop/attribpaint?ViewerStateInstall”, line 1, in <module>
File “C:/PROGRA~1/SIDEEF~1/HOUDIN~1.287/houdini/python3.7libs\viewerstate\utils.py”, line 948, in register_pystate_embedded
template = node_type.hdaViewerStateModule().createViewerStateTemplate()
File “C:/PROGRA~1/SIDEEF~1/HOUDIN~1.287/houdini/python3.7libs\hou.py”, line 44976, in __getattr__
return _hou.HDAViewerStateModule___getattr__(self, name)
AttributeError: ‘module’ object has no attribute ‘createViewerStateTemplate’

Qt Warn: Sub class of QObject not inheriting QObject!? Crash will happen when using BackgroundEventHandler.
Qt Warn: Sub class of QObject not inheriting QObject!? Crash will happen when using TaskGraphTableModel.
Qt Warn: Sub class of QObject not inheriting QObject!? Crash will happen when using PaginationHelper.
Qt Warn: Sub class of QObject not inheriting QObject!? Crash will happen when using WorkItemTableModel.
Edited by fabriciochamon - 2019年11月29日 17:38:44
User Avatar
Member
201 posts
Joined: 7月 2015
Offline
AFAIK, the python3 builds of Houdini are in a very early stadium. They probably do not have a public list of what is working and what is not.

I'm not sure if they even accept RFEs/BUGs for it yet.
Manuel Köster - Senior Technical Artist @Remedy Entertainment

https://www.remedygames.com/ [www.remedygames.com]
http://shadesoforange.de/ [shadesoforange.de]
https://twitter.com/ShadesOfOrange_ [twitter.com]
User Avatar
Member
67 posts
Joined: 1月 2014
Online
thanks Manuel. yes, looks like it's still early days for Python 3, I just wanted to let the guys know, maybe it could be an easy fix
User Avatar
Member
900 posts
Joined: 2月 2016
Offline
is it still not outputting to console?
not even outputting to the python shell, it seems.

Am I missing smthing? I'm on 18.5.351 py3 build
Edited by Andr - 2020年11月28日 15:37:12
User Avatar
Member
53 posts
Joined: 4月 2012
Offline
Andr
is it still not outputting to console?
not even outputting to the python shell, it seems.

Am I missing smthing? I'm on 18.5.351 py3 build

I am having the same behaviour on py3 builds only. Must be a bug, the only way I can get it to print to console is via
os.write
But that is not ideal...

Neither
print()
nor
sys.stdout
seem to work.
Edited by ant_vfx - 2021年1月6日 00:03:44
User Avatar
Member
26 posts
Joined: 5月 2013
Offline
+1 on this topic.

I just updated to Houdini 18.5 and also just noticed this.
I make a lot of use of this to debug, or provide feedback to the user. having to open the python shell to get information is annoying.

I'd like it to be able to output to the console on print like it has been able to.
User Avatar
Member
1904 posts
Joined: 11月 2006
Offline
You guys might want to check out today's build:

Houdini 18.5.458 Modified the Python 3 build so that it uses unbuffered stdout and stderr (i.e. PYTHONUNBUFFERED=1), which restores the behavior that was in Python 2. This fixes an issue where print outs did not appear in the Windows Console on Windows unless the `flush=True` argument was passed into the print function calls.
Graham Thompson, Technical Artist @ Rockstar Games
User Avatar
Member
53 posts
Joined: 4月 2012
Offline
graham
You guys might want to check out today's build:

Houdini 18.5.458 Modified the Python 3 build so that it uses unbuffered stdout and stderr (i.e. PYTHONUNBUFFERED=1), which restores the behavior that was in Python 2. This fixes an issue where print outs did not appear in the Windows Console on Windows unless the `flush=True` argument was passed into the print function calls.

Oh, I missed the update! I can confirm this fixed it.
  • Quick Links