[IPython-user] [pyreadline]Support for running as subprocess?

Liu Jin m.liu.jin at gmail.com
Mon Mar 13 10:15:15 CST 2006


On Windows, IPython running as an inferior process in Emacs produces
no output. That's because Windows has no psuedo-tty, so the
WriteConsole etc. calls are failing. I made a quick&dirty change to
console.py along these lines:

import os
ntemacs_hack = int(os.environ.get('READLINE_NTEMACS_HACK','0'))

class Console(object):
    ...
    if ntemacs_hack:
        def write_color(self, text, attr=None):
            junk = c_int(0)
            self.WriteFile(self.hout, text, len(text), byref(junk), None)
            return len(text)

        write_plain = write_color
    else:
        original write_color & write_plain definitions
    ...

The main functionalities seem ok. But there are plenty more console
api calls uncovered, yet I'm uncertain how to fix them. I guess this
problem will eventually disappear as IPython be decoupled from
readline, but any chance for a quick fix before that?




More information about the IPython-user mailing list