[IPython-user] PyReadline: No tab completion if sys.stdout is redirected

Dirk Loss lists@dirk-loss...
Thu Dec 20 05:29:39 CST 2007


Hi,

> I'm not sure why things work like this but I have attached a script with 
> a possible workaround.

Thanks. Do you have any idea how to make this work with code.interact()
instead of raw_input()?

I have tried the following workaround: Leave sys.stdout untouched but 
redirect all "print" statements explicitly to the custom file-like 
console object. I had to change all print statements, but it works.
To automatically evaluate expressions entered interactively and use my 
custom console object, I used sys.displayhook.

But there's one issue still: If the string is too long, there's no 
output. See the attachment for an example. I think the problem is in the 
self.console.write() call, because everything is ok if I call 
self.orig_stdout.write() instead.

Regards
Dirk




-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: interact-tester.py
Url: http://lists.ipython.scipy.org/pipermail/ipython-user/attachments/20071220/495eac91/attachment.pl 


More information about the IPython-user mailing list