ipython / ipython/ipykernel

ipykernel should not assume interactive terminal

Aperta
#415 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
Python
Stelle
734
Fork
412
Merge medio
1g 5h
PR unite (30g)
8

Descrizione

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.

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.