Show More
@@ -29,6 +29,11 import base64 | |||||
29 |
|
29 | |||
30 | from Queue import Empty |
|
30 | from Queue import Empty | |
31 |
|
31 | |||
|
32 | try: | |||
|
33 | from contextlib import nested | |||
|
34 | except: | |||
|
35 | from IPython.utils.nested_context import nested | |||
|
36 | ||||
32 | from IPython.core.alias import AliasManager, AliasError |
|
37 | from IPython.core.alias import AliasManager, AliasError | |
33 | from IPython.core import page |
|
38 | from IPython.core import page | |
34 | from IPython.utils.warn import warn, error, fatal |
|
39 | from IPython.utils.warn import warn, error, fatal | |
@@ -280,8 +285,8 class ZMQTerminalInteractiveShell(TerminalInteractiveShell): | |||||
280 | raw = base64.decodestring(data[mime]) |
|
285 | raw = base64.decodestring(data[mime]) | |
281 | imageformat = self._imagemime[mime] |
|
286 | imageformat = self._imagemime[mime] | |
282 | ext = '.{0}'.format(imageformat) |
|
287 | ext = '.{0}'.format(imageformat) | |
283 |
with tempfile.NamedTemporaryFile(suffix=ext) |
|
288 | with nested(tempfile.NamedTemporaryFile(suffix=ext), | |
284 | open(os.devnull, 'w') as devnull: |
|
289 | open(os.devnull, 'w')) as (f, devnull): | |
285 | f.write(raw) |
|
290 | f.write(raw) | |
286 | f.flush() |
|
291 | f.flush() | |
287 | fmt = dict(file=f.name, format=imageformat) |
|
292 | fmt = dict(file=f.name, format=imageformat) |
General Comments 0
You need to be logged in to leave comments.
Login now