<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
<br>
As you can see above, ipython's stdout is the bare python one.</blockquote><div><br>Yes -- I figured that out shortly after sending my first email ... <br> <br><br></div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
problem is that your class is missing a ton of other attributes.<br>
</blockquote><div><br>Yes -- I figured this too. So in my last email to list two days ago I posted that I tried pretty much what you suggested: something catches all attributes except write and redirects them to the original stdout's attribute. (See below for the code). It also fails, in the same way. <br>
<br>Is the reason that it fails that I haven't been carefl enough in catching all attributes? Or have I done it right and something more subtle going on? (What exactly does ipython do when you input "up" or "down" arrows?) <br>
<br>Thanks,<br>Dan<br><br>=======CODE==============<br><br></div>class multicaster():<br> def __init__(self,filename,OldObject,New=False):<br><div><div class="Ih2E3d"> self.file = filename<br> self.old = OldObject<br>
if New:<br> F = open(filename,'w')<br> F.write('\n\n----------------------------------------------------------------------------------------------------------- -------------------------------------------\n')<br>
F.write('STARTING LOG: ' + time.strftime('%c %Z') + '\n')<br> F.write('------------------------------------------------------------------------------------------------------------------------------------------------------\n\n')<br>
F.close()<br> <br></div> def __getattr__(self,name):<br> if name != 'write':<br> return self.old.__getattribute__(name)<br> <br> def write(self,s):<br>
<div class="Ih2E3d"> F = open(self.file,'a')<br>
F.write(s)<br> F.close() <br></div> return self.old.write(s)</div></div><br>