##// END OF EJS Templates
Use Python 2.6 compatible with statement
Takafumi Arakaki -
Show More
@@ -29,6 +29,11 b' import base64'
29 29
30 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 37 from IPython.core.alias import AliasManager, AliasError
33 38 from IPython.core import page
34 39 from IPython.utils.warn import warn, error, fatal
@@ -280,8 +285,8 b' class ZMQTerminalInteractiveShell(TerminalInteractiveShell):'
280 285 raw = base64.decodestring(data[mime])
281 286 imageformat = self._imagemime[mime]
282 287 ext = '.{0}'.format(imageformat)
283 with tempfile.NamedTemporaryFile(suffix=ext) as f, \
284 open(os.devnull, 'w') as devnull:
288 with nested(tempfile.NamedTemporaryFile(suffix=ext),
289 open(os.devnull, 'w')) as (f, devnull):
285 290 f.write(raw)
286 291 f.flush()
287 292 fmt = dict(file=f.name, format=imageformat)
General Comments 0
You need to be logged in to leave comments. Login now