Skip to content

Replacing the streams breaks IPython #2

@pfmoore

Description

@pfmoore

In the IPython interactive console, if I type

import win_unicode_console.streams
win_unicode_console.streams.enable()

I get an infinite stream of errors, all of which appear to be as follows:

ArgumentError                             Traceback (most recent call last)
C:\Users\uk03306\AppData\Local\Continuum\Anaconda3\lib\site-packages\IPython\terminal\interactiveshell.py in raw_input(self, prompt)
    588
    589         try:
--> 590             line = py3compat.str_to_unicode(self.raw_input_original(prompt))
    591         except ValueError:
    592             warn("\n********\nYou or a %run:ed script called sys.stdin.close()"

C:\Users\uk03306\AppData\Local\Continuum\Anaconda3\lib\site-packages\win_unicode_console\streams.py in write(self, b)
     84                 code_units_written = c_int()
     85
---> 86                 retval = WriteConsoleW(self.handle, buffer, code_units_to_be_written, byref(code_units_written), None)
     87                 bytes_written = 2 * code_units_written.value
     88

ArgumentError: argument 4: <class 'TypeError'>: expected LP_c_ulong instance instead of pointer to c_long

I'm sure this counts as just another case of "the module doesn't play nicely with the interactive REPL" (that same enable call fails in a normal Python console, or one with just pyreadline installed, as well, but not quite as badly...), but I thought I'd report it here just in case there was something else going on. I have pyreadline installed with IPython, as recommended, and that does some fairly complicated low-level console hacking which might interact badly with this module.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions