The comment on that answer seems to answer your or problem here. While you
are changing the sys.stdout reference you are only doing it at a point in
time. Any module that gets loaded earlier and grabs a reference will have
the original.
I thought there were already some Maya utilities for interfacing with the
script editor? Maya has its own references that it moves into private
stdout/stderr
On Mar 13, 2014 10:05 AM, "deanareeno" <[email protected]> wrote:

> Hey all,
>
> I implemented a version of the following into a module (the checkmarked
> answer version):
>
>
> https://stackoverflow.com/questions/19855288/duplicate-stdout-stderr-in-qtextedit-widget
>
> (the OutputWrapper class and handleOutput method specifcally)
>
> ...and it's working in the sense that if I call:
>
> sys.stdout.write('Here's stdout')
> sys.stdout.write('Here's stderr')
>
> ...I see each in Maya's script editor and my pyqt widget. I've also
> imported logging, set the logging level to INFO, and added a StreamHandler
> for stdout & stderr in my main module.
>
> What's driving me nuts is that I *only* see output in both the Script
> Editor and my widget if I do explicit sys.std*.write() calls in my module.
> Any imported functions or methods that have logging enabled passing INFO
> level messages or even traceback errors show up *only* in the script editor.
>
> I tried changing the self._stream lines in the stackoverflow example to
> use maya.utils.Output()/ maya.utils.Output(error=1), and even
> sys.__stdout__/sys.__stderr__ directly, but I get the same results (with
> slightly different formatting).
>
> Any ideas to point me in the right direction?
>
> Cheers,
>
> -DW
>
>
>
>
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Python Programming for Autodesk Maya" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/python_inside_maya/f0605a26-6467-4eed-998a-dcfa8a31cfdd%40googlegroups.com<https://groups.google.com/d/msgid/python_inside_maya/f0605a26-6467-4eed-998a-dcfa8a31cfdd%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA3BukjcTDQNK5sxyX%2BvjwogiSZJgmPS2C8NVPhdFQHU8A%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to