[IPython-User] Windows GUI only (pythonw) bug for IPython on Python 3.x

Brandon Parsons brandon@parsonstx....
Wed Jan 4 02:55:05 CST 2012

Trying to launch the ipython-qtconsole.exe or ipython-qtconsole-script.pyw
via pythonw on Python 3.2 immediately exits, and the Qt console never
starts.  Running with ipython-qtconsole-script.pyw with plain python.exe
works fine (and consumes the console). Fortunately, redirection stdout and
stderr allows to get the traceback (well, stderr is where it went), which
yields the following:

Traceback (most recent call last):
  File "\Python32\Scripts\ipython3-qtconsole-script.pyw", line 9, in
    load_entry_point('ipython==0.12', 'gui_scripts', 'ipython3-qtconsole')()
line 337, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
line 2280, in load_entry_point
    return ep.load()
line 1990, in load
    entry = __import__(self.module_name, globals(),globals(), ['__name__'])
  File "C:\Python32\lib\site-packages\IPython\__init__.py", line 43, in
    from .config.loader import Config
  File "C:\Python32\lib\site-packages\IPython\config\loader.py", line 27,
in <module>
    from IPython.utils.path import filefind, get_ipython_dir
  File "C:\Python32\lib\site-packages\IPython\utils\path.py", line 24, in
    from IPython.utils.process import system
  File "C:\Python32\lib\site-packages\IPython\utils\process.py", line 25,
in <module>
    from ._process_win32 import _find_cmd, system, getoutput, AvoidUNCPath,
  File "C:\Python32\lib\site-packages\IPython\utils\_process_win32.py",
line 30, in <module>
    from . import text
  File "C:\Python32\lib\site-packages\IPython\utils\text.py", line 30, in
    from IPython.utils.io import nlprint
  File "C:\Python32\lib\site-packages\IPython\utils\io.py", line 90, in
    stdin = IOStream(sys.stdin)
  File "C:\Python32\lib\site-packages\IPython\utils\io.py", line 32, in
    raise ValueError("fallback required, but not specified")
ValueError: fallback required, but not specified

I was confused why nobody had seen this before, but come to find out it's a
Python 3 vs 2 issue.  sys.std* are now None for pythonw processes in Python
3.x, while they were file objects with fileno == -2 on Python 2.x.  Regular
old prints will work when stdout/stderr are None, but they just get
discarded immediately, but of course any attribute lookups are going to

This simple script run with pythonw (on v2 and v3) highlights the
# this will show what the std* file handles are on Python 2.x vs Python 3.x
# noted @ http://bugs.python.org/issue1415
import sys

fname = 'python%d_std_fds.txt' % (sys.version_info[0])
f = open(fname, 'w')

if sys.stdin is None:
    f.write("stdin: None\n")
    f.write("stdin: %i\n" % sys.stdin.fileno())
if sys.stdout is None:
    f.write("stdout: None\n")
    f.write("stdout: %i\n" % sys.stdout.fileno())
if sys.stderr is None:
    f.write("stderr: None\n")
    f.write("stderr: %i\n" % sys.stderr.fileno())

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/ipython-user/attachments/20120104/98a769e7/attachment.html 

More information about the IPython-User mailing list