<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: wxPython &#8211; Redirecting stdout / stderr</title>
	<atom:link href="http://www.blog.pythonlibrary.org/2009/01/01/wxpython-redirecting-stdout-stderr/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.blog.pythonlibrary.org/2009/01/01/wxpython-redirecting-stdout-stderr/</link>
	<description>Python Programming from the Frontlines</description>
	<lastBuildDate>Sun, 05 Sep 2010 11:08:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>By: Anonymous</title>
		<link>http://www.blog.pythonlibrary.org/2009/01/01/wxpython-redirecting-stdout-stderr/comment-page-1/#comment-21434</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Wed, 18 Aug 2010 15:24:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.blog.pythonlibrary.org/?p=120#comment-21434</guid>
		<description>What do you mean? It won&#039;t be able to redirect anything until the MainLoop starts. If you have loops, put them in a function and call that after your application starts. You can use a button or just wx.CallAfter. 

- Mike</description>
		<content:encoded><![CDATA[<p>What do you mean? It won&#8217;t be able to redirect anything until the MainLoop starts. If you have loops, put them in a function and call that after your application starts. You can use a button or just wx.CallAfter. </p>
<p>- Mike</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dani Valverde</title>
		<link>http://www.blog.pythonlibrary.org/2009/01/01/wxpython-redirecting-stdout-stderr/comment-page-1/#comment-21433</link>
		<dc:creator>Dani Valverde</dc:creator>
		<pubDate>Wed, 18 Aug 2010 15:18:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.blog.pythonlibrary.org/?p=120#comment-21433</guid>
		<description>Thank you so much for this interesting post. However, it seems that it only redirects the stdout when the function is complete. In my case, there are loops inside the function, and I would like to redirect the stdout at each loop. How can I do it?
Cheers!

Dani</description>
		<content:encoded><![CDATA[<p>Thank you so much for this interesting post. However, it seems that it only redirects the stdout when the function is complete. In my case, there are loops inside the function, and I would like to redirect the stdout at each loop. How can I do it?<br />
Cheers!</p>
<p>Dani</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: paladin</title>
		<link>http://www.blog.pythonlibrary.org/2009/01/01/wxpython-redirecting-stdout-stderr/comment-page-1/#comment-21302</link>
		<dc:creator>paladin</dc:creator>
		<pubDate>Fri, 13 Aug 2010 00:24:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.blog.pythonlibrary.org/?p=120#comment-21302</guid>
		<description>Thanks for the quick response.  It worked perfectly.</description>
		<content:encoded><![CDATA[<p>Thanks for the quick response.  It worked perfectly.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Anonymous</title>
		<link>http://www.blog.pythonlibrary.org/2009/01/01/wxpython-redirecting-stdout-stderr/comment-page-1/#comment-21286</link>
		<dc:creator>Anonymous</dc:creator>
		<pubDate>Thu, 12 Aug 2010 03:10:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.blog.pythonlibrary.org/?p=120#comment-21286</guid>
		<description>Just save a reference to stdout. Something like  &quot;self.stdoutRef = sys.stdout&quot;. Then after you&#039;ve redirected it, you can restore it by doing the reverse:  sys.stdout = self.stdoutRef</description>
		<content:encoded><![CDATA[<p>Just save a reference to stdout. Something like  &#8220;self.stdoutRef = sys.stdout&#8221;. Then after you&#8217;ve redirected it, you can restore it by doing the reverse:  sys.stdout = self.stdoutRef</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: paladin</title>
		<link>http://www.blog.pythonlibrary.org/2009/01/01/wxpython-redirecting-stdout-stderr/comment-page-1/#comment-21276</link>
		<dc:creator>paladin</dc:creator>
		<pubDate>Thu, 12 Aug 2010 00:15:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.blog.pythonlibrary.org/?p=120#comment-21276</guid>
		<description>Can you tell me how to set things back to stdout when I finish with the display</description>
		<content:encoded><![CDATA[<p>Can you tell me how to set things back to stdout when I finish with the display</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike</title>
		<link>http://www.blog.pythonlibrary.org/2009/01/01/wxpython-redirecting-stdout-stderr/comment-page-1/#comment-16934</link>
		<dc:creator>Mike</dc:creator>
		<pubDate>Fri, 05 Feb 2010 04:01:03 +0000</pubDate>
		<guid isPermaLink="false">http://www.blog.pythonlibrary.org/?p=120#comment-16934</guid>
		<description>Thanks guys. Sorry my commenting system didn&#039;t keep the formatting of your code very well. I think someone mentioned that I should try writing a redirect logging tutorial one time, but now I don&#039;t have to.

- Mike</description>
		<content:encoded><![CDATA[<p>Thanks guys. Sorry my commenting system didn&#8217;t keep the formatting of your code very well. I think someone mentioned that I should try writing a redirect logging tutorial one time, but now I don&#8217;t have to.</p>
<p>- Mike</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mike</title>
		<link>http://www.blog.pythonlibrary.org/2009/01/01/wxpython-redirecting-stdout-stderr/comment-page-1/#comment-22743</link>
		<dc:creator>Mike</dc:creator>
		<pubDate>Fri, 05 Feb 2010 04:01:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.blog.pythonlibrary.org/?p=120#comment-22743</guid>
		<description>Thanks guys. Sorry my commenting system didn&#039;t keep the formatting of your code very well. I think someone mentioned that I should try writing a redirect logging tutorial one time, but now I don&#039;t have to.

- Mike</description>
		<content:encoded><![CDATA[<p>Thanks guys. Sorry my commenting system didn&#8217;t keep the formatting of your code very well. I think someone mentioned that I should try writing a redirect logging tutorial one time, but now I don&#8217;t have to.</p>
<p>- Mike</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mgag</title>
		<link>http://www.blog.pythonlibrary.org/2009/01/01/wxpython-redirecting-stdout-stderr/comment-page-1/#comment-16932</link>
		<dc:creator>mgag</dc:creator>
		<pubDate>Fri, 05 Feb 2010 01:07:31 +0000</pubDate>
		<guid isPermaLink="false">http://www.blog.pythonlibrary.org/?p=120#comment-16932</guid>
		<description>I was posting from multiple threads, so I needed the fix from the original submission,

class WxLog(logging.Handler):
    def __init__(self, ctrl):
        logging.Handler.__init__(self)
        self.ctrl = ctrl
        
    def emit(self, record):
        log = self.format(record)+&quot;\n&quot;
        wx.CallAfter(self.ctrl.AppendText, log)</description>
		<content:encoded><![CDATA[<p>I was posting from multiple threads, so I needed the fix from the original submission,</p>
<p>class WxLog(logging.Handler):<br />
    def __init__(self, ctrl):<br />
        logging.Handler.__init__(self)<br />
        self.ctrl = ctrl</p>
<p>    def emit(self, record):<br />
        log = self.format(record)+&#8221;\n&#8221;<br />
        wx.CallAfter(self.ctrl.AppendText, log)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mgag</title>
		<link>http://www.blog.pythonlibrary.org/2009/01/01/wxpython-redirecting-stdout-stderr/comment-page-1/#comment-22742</link>
		<dc:creator>mgag</dc:creator>
		<pubDate>Fri, 05 Feb 2010 01:07:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.blog.pythonlibrary.org/?p=120#comment-22742</guid>
		<description>I was posting from multiple threads, so I needed the fix from the original submission,

class WxLog(logging.Handler):
    def __init__(self, ctrl):
        logging.Handler.__init__(self)
        self.ctrl = ctrl
        
    def emit(self, record):
        log = self.format(record)+&quot;n&quot;
        wx.CallAfter(self.ctrl.AppendText, log)</description>
		<content:encoded><![CDATA[<p>I was posting from multiple threads, so I needed the fix from the original submission,</p>
<p>class WxLog(logging.Handler):<br />
    def __init__(self, ctrl):<br />
        logging.Handler.__init__(self)<br />
        self.ctrl = ctrl</p>
<p>    def emit(self, record):<br />
        log = self.format(record)+&#8221;n&#8221;<br />
        wx.CallAfter(self.ctrl.AppendText, log)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mgag</title>
		<link>http://www.blog.pythonlibrary.org/2009/01/01/wxpython-redirecting-stdout-stderr/comment-page-1/#comment-16931</link>
		<dc:creator>mgag</dc:creator>
		<pubDate>Fri, 05 Feb 2010 01:06:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.blog.pythonlibrary.org/?p=120#comment-16931</guid>
		<description>Figured it out - that didn&#039;t take long.  I am posting from threads, so I needed the thread-safe version of the &quot;emit&quot;, like so,

class WxLog(logging.Handler):
    def __init__(self, ctrl):
        logging.Handler.__init__(self)
        self.ctrl = ctrl
        
    def emit(self, record):
        log = self.format(record)+&quot;\n&quot;
        wx.CallAfter(self.ctrl.AppendText, log)</description>
		<content:encoded><![CDATA[<p>Figured it out &#8211; that didn&#8217;t take long.  I am posting from threads, so I needed the thread-safe version of the &#8220;emit&#8221;, like so,</p>
<p>class WxLog(logging.Handler):<br />
    def __init__(self, ctrl):<br />
        logging.Handler.__init__(self)<br />
        self.ctrl = ctrl</p>
<p>    def emit(self, record):<br />
        log = self.format(record)+&#8221;\n&#8221;<br />
        wx.CallAfter(self.ctrl.AppendText, log)</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic Page Served (once) in 8.007 seconds -->
