<br><br><div class="gmail_quote">On Mon, Jun 29, 2009 at 12:17 PM, Gertjan Klein <span dir="ltr">&lt;<a href="mailto:gklein@xs4all.nl">gklein@xs4all.nl</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Tim Roberts wrote:<br>
<div class="im"><br>
&gt;Gertjan Klein wrote:<br>
</div><div class="im">
&gt;&gt; 2) I see print statements in the source code, but I have no idea where<br>
&gt;&gt; they go; I checked the event log, but they are not there. Are they<br>
&gt;&gt; logged anywhere? If not, why are they there to begin with?<br>
&gt;&gt;<br>
&gt;&gt; Any other tip on how to effectively debug this stuff would be most<br>
&gt;&gt; welcome as well.<br>
&gt;<br>
&gt;The print statements go into empty space because there is no stdout for<br>
&gt;that process.  You can try using the logging module to log to a file, or<br>
&gt;you can use ctypes to write to kernel32.OutputDebugString and using a<br>
&gt;kernel debug log monitor to read them.<br>
<br>
</div>The logging module reminds me of Java too much. :(  I think I&#39;ll try to<br>
write to a file, I have no idea if I have a kernel debug log monitor.<br>
<br>
<div><div class="h5">
<a href="http://mail.python.org/mailman/listinfo/python-win32" target="_blank"></a></div></div></blockquote><div><br>sys.stdout works like a normal Python file, so you should be able to assign a new file object to it.<br>
<br></div></div>You might try something like:<br>--------------<br>&gt;&gt;&gt; x = open(&#39;x.txt&#39;,&#39;w&#39;)<br>&gt;&gt;&gt; import sys<br>&gt;&gt;&gt; sys.stdout = x<br>&gt;&gt;&gt; print &#39;hello, world&#39;<br>
&gt;&gt;&gt; exit()<br><br>C:\Users\vernon&gt;type x.txt<br>hello, world<br>-----------<br>For debugging, you may want to add <br>sys.stderr = x<br>as well.<br>--<br>Vernon Cole<br><br><br>