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

Dirk Loss lists@dirk-loss...
Thu Dec 20 14:55:58 CST 2007


Jörgen Stenarson wrote:
 > unfortunately I have never used code.interact myself so I do not know
 > how it works.

A solution that redirects sys.stdout would be really nice, because
then I wouldn't have to turn all "print" statements into "print >>
console".

But at the moment I am more concerned about the problem I have with my
workaround (explicitly redirecting the output). Here is an even shorter
example that shows this problem:

 >>> import readline
 >>> class Console(object):
...   def write(self, text):
...      readline.GetOutputFile().write(text)
...
 >>> console=Console()
 >>> print >> console, "a" * 10
aaaaaaaaaa
 >>> print >> console, "a" * 100000

 >>>

The second print statement doesn't have any output. Why? On my system
the limit is circa at 26000, but it tends to vary.

Regards
Dirk


More information about the IPython-user mailing list