ipython / ipython/ipykernel

ipykernel should not assume interactive terminal

オープン
#415 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Python
スター
734
フォーク
412
平均マージ
1日 5時間
マージ済み PR(30日)
8

説明

There are a couple of places in `ipykernel` that seem assume interactive terminal

This builds automated Travis builds. See for example errors in `jupyter-incubator/sparkmagic` project in one of the PRs
https://travis-ci.org/jupyter-incubator/sparkmagic/jobs/550505401

as discussed here
https://github.com/jupyter-incubator/sparkmagic/pull/541

There are two types of exceptions in Travis logs
```
ip.showtraceback(exc_info)
File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/IPython/core/interactiveshell.py", line 1868, in showtraceback
self._showtraceback(etype, value, stb)
File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/ipykernel/zmqshell.py", line 557, in _showtraceback
exc_msg = dh.session.send(dh.pub_socket, u'error', json_clean(exc_content),
AttributeError: 'NoneType' object has no attribute 'send'

```

and
```
publish_display_data(data=obj, metadata=metadata, **kwargs)
File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/IPython/core/display.py", line 120, in publish_display_data
**kwargs
File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/ipykernel/zmqshell.py", line 128, in publish
msg = self.session.msg(
AttributeError: 'NoneType' object has no attribute 'msg'
```

I think Travis runs in a non-interactive shell that's why those things fail - notice
code path has
```
File "/home/travis/virtualenv/python3.6.7/lib/python3.6/site-packages/IPython/core/interactiveshell.py",
```

`sys.stdout.isatty()` would be false and this has to be processed in `ipykernel` / `IPython`
separately - which would indicate a non-interactive terminal (no tty).

Thank you.

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。