ipython / ipython/ipykernel

ipykernel should not assume interactive terminal

Offen
#415 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Python
Sterne
734
Forks
412
Ø Merge
1 T. 5 Std.
Gemergte PRs (30 T.)
8

Beschreibung

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.

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Start by inspecting the ipykernel/zmqshell.py paths shown in the tracebacks, especially _showtraceback and publish, and compare their behavior when the session or socket is unavailable. Reproduce the reported Travis-style non-interactive execution and verify that traceback and display publishing no longer fail with NoneType attribute errors.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
python
Bereich
backend
Issue-Typ
Bug
Schwierigkeit
3/5
Geschätzter Aufwand
1-2 Tage
Aktivitätsstatus
Veraltet
Klarheit
Muss geklärt werden
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.