Repository: ipython/ipython

Issue:
problem in jupyter_qtconsole with ipython5.0b1
I get this error trying to launch jupyter-qtconsole:
![ipython5_pb2](https://cloud.githubusercontent.com/assets/4312421/15798478/52a6f290-2a3a-11e6-9c27-7b856de44eb1.png)

config:
config: windows7/Python3.5.1 32 bit, and:
adodbapi (2.6.0.7)
alabaster (0.7.8)
astroid (1.4.5)
astroML (0.3)
Babel (2.3.2)
backports-abc (0.4)
baresql (0.7.3)
bcolz (1.0.0)
beautifulsoup4 (4.4.1)
blaze (0.10.1)
blosc (1.3.2)
bloscpack (0.9.0)
bokeh (0.11.1)
boto3 (1.3.1)
botocore (1.4.24)
Bottleneck (1.0.0)
bqplot (0.6.1)
brewer2mpl (1.4.1)
castra (0.1.7)
certifi (2016.2.28)
cffi (1.6.0)
click (6.6)
cloudpickle (0.2.1)
colorama (0.3.7)
CommonMark (0.5.4)
cvxopt (1.1.7)
cx-Freeze (4.3.4)
cycler (0.10.0)
cyordereddict (1.0.0)
Cython (0.24)
cytoolz (0.8.0)
dask (0.9.0)
datashape (0.5.2)
db.py (0.4.4)
decorator (4.0.7)
dill (0.2.5)
distributed (1.10.2)
docopt (0.6.2)
docrepr (0.1.0)
docutils (0.12)
emcee (2.1.0)
entrypoints (0.2.2)
fasteners (0.14.1)
Flask (0.11)
Flask-Cors (2.1.2)
formlayout (1.1.0)
geopy (1.11.0)
greenlet (0.4.9)
guidata (1.7.5)
guiqwt (3.0.2)
h5py (2.6.0)
holoviews (1.5.0)
html5lib (0.9999999)
husl (4.0.3)
idlex (1.13)
imagesize (0.7.1)
ipykernel (4.3.1)
ipyleaflet (0.2.0)
ipyparallel (5.0.1)
ipython (5.0.0b1)
ipython-genutils (0.1.0)
ipython-sql (0.3.7.1)
ipywidgets (5.1.5)
itsdangerous (0.24)
jedi (0.9.0)
Jinja2 (2.8)
jmespath (0.9.0)
joblib (0.9.4)
jsonschema (2.5.1)
julia (0.1.1.8)
jupyter (1.0.0)
jupyter-client (4.2.2)
jupyter-console (4.1.1)
jupyter-core (4.1.0)
Keras (1.0.3)
Lasagne (0.2.dev1)
lazy-object-proxy (1.2.2)
llvmlite (0.11.0)
lmfit (0.9.3)
locket (0.2.0)
lxml (3.6.0)
Markdown (2.6.6)
MarkupSafe (0.23)
matplotlib (1.5.2rc2)
mistune (0.7.2)
mkl-service (1.1.2)
monotonic (1.1)
mpld3 (0.2)
mpmath (0.19)
msgpack-python (0.4.7)
multipledispatch (0.4.8)
mysql-connector-python (2.0.4)
nbconvert (4.2.0)
nbformat (4.0.1)
nbsphinx (0.2.8)
netCDF4 (1.2.4)
networkx (1.11)
nltk (3.2.1)
nose (1.3.7)
notebook (4.2.1)
numba (0.26.0)
numexpr (2.6.0)
numpy (1.10.4)
numpydoc (0.6.0)
oct2py (3.5.7)
odo (0.5.0)
pandas (0.18.1)
pandas-datareader (0.2.0)
param (1.3.2)
partd (0.3.3)
patsy (0.4.1)
pep8 (1.7.0)
pg8000 (1.10.5)
pickleshare (0.7.2)
Pillow (3.2.0)
pip (8.1.2)
pkginfo (1.3.2)
prettytable (0.7.2)
prompt-toolkit (1.0.0)
psutil (4.2.0)
ptpython (0.34)
PuLP (1.6.1)
py (1.4.31)
PyAudio (0.2.9)
pybars3 (0.9.1)
pycparser (2.14)
pyflakes (1.2.3)
Pygments (2.1.3)
pylint (1.5.5)
pymc (2.3.6)
pymc3 (3.0)
PyMeta3 (0.5.1)
pymongo (3.2.2)
pyodbc (3.0.10)
PyOpenGL (3.1.1)
pyparsing (2.1.4)
PyQt4 (4.11.4)
PyQtdesignerplugins (1.1)
pyqtgraph (0.9.10)
PyQwt (5.2.1)
pyreadline (2.1)
pyserial (3.1)
pystache (0.5.4)
pytest (2.9.1)
python-dateutil (2.5.3)
python-hdf4 (0.9)
pythonnet (2.1.0)
PythonQwt (0.5.5)
pytz (2016.4)
pywin32 (220.1)
PyYAML (3.11)
pyzmq (15.2.0)
QtAwesome (0.3.3)
qtconsole (4.2.1)
QtPy (1.0.2)
recommonmark (0.4.0)
redis (2.10.5)
reportlab (3.3.0)
requests (2.10.0)
requests-toolbelt (0.6.2)
rope-py3k (0.9.4.post1)
rpy2 (2.7.8)
Rx (1.5.2)
s3fs (0.0.5)
scikit-image (0.12.3)
scikit-learn (0.17.1)
scikit-neuralnetwork (0.7)
scilab2py (0.6)
scipy (0.17.1)
seaborn (0.7.0)
setuptools (21.2.2)
simplegeneric (0.8.1)
simplejson (3.8.2)
six (1.10.0)
snowballstemmer (1.2.1)
Sphinx (1.4.2)
sphinx-rtd-theme (0.1.9)
spyder (3.0.0.dev0)
SQLAlchemy (1.0.13)
sqlite-bro (0.8.11)
sqlparse (0.1.19)
statsmodels (0.6.1)
sympy (1.0)
tables (3.2.2)
tblib (1.3.0)
Theano (0.8.2)
toolz (0.8.0)
tornado (4.3)
traitlets (4.2.1)
twine (1.6.5)
twitter (1.17.1)
ViTables (2.1)
wcwidth (0.1.6)
Werkzeug (0.11.10)
wheel (0.29.0)
widgetsnbextension (1.2.3)
winpython (1.6.20160531)
wordcloud (1.2.1)
wrapt (1.10.8)
xarray (0.7.2)
xlrd (0.9.4)
XlsxWriter (0.8.7)
zarr (1.0.0)



Discussion:

Resolving patch:
diff --git a/IPython/terminal/ptshell.py b/IPython/terminal/ptshell.py
--- a/IPython/terminal/ptshell.py
+++ b/IPython/terminal/ptshell.py
@@ -50,7 +50,14 @@ def get_default_editor():
     else:
         return 'notepad' # same in Windows!
 
-_use_simple_prompt = 'IPY_TEST_SIMPLE_PROMPT' in os.environ or not sys.stdin.isatty()
+
+if sys.stdin and sys.stdout and sys.stderr:
+    _is_tty = (sys.stdin.isatty()) and (sys.stdout.isatty()) and  (sys.stderr.isatty())
+else:
+    _is_tty = False
+
+
+_use_simple_prompt = ('IPY_TEST_SIMPLE_PROMPT' in os.environ) or (not _is_tty)
 
 class TerminalInteractiveShell(InteractiveShell):
     colors_force = True


Test patch: