Show More
@@ -19,6 +19,7 b' from __future__ import print_function' | |||
|
19 | 19 | |
|
20 | 20 | import bdb |
|
21 | 21 | import signal |
|
22 | import os | |
|
22 | 23 | import sys |
|
23 | 24 | import time |
|
24 | 25 | import tempfile |
@@ -269,23 +270,23 b' class ZMQTerminalInteractiveShell(TerminalInteractiveShell):' | |||
|
269 | 270 | imageformat = self._imagemime[mime] |
|
270 | 271 | fmt = dict(format=imageformat) |
|
271 | 272 | args = [s.format(**fmt) for s in self.stream_image_handler] |
|
273 | with open(os.devnull, 'w') as devnull: | |
|
272 | 274 | proc = subprocess.Popen( |
|
273 | 275 | args, stdin=subprocess.PIPE, |
|
274 | stdout=subprocess.PIPE, stderr=subprocess.PIPE) | |
|
276 | stdout=devnull, stderr=devnull) | |
|
275 | 277 | proc.communicate(raw) |
|
276 | 278 | |
|
277 | 279 | def handle_image_tempfile(self, data, mime): |
|
278 | 280 | raw = base64.decodestring(data[mime]) |
|
279 | 281 | imageformat = self._imagemime[mime] |
|
280 | 282 | ext = '.{0}'.format(imageformat) |
|
281 |
with tempfile.NamedTemporaryFile(suffix=ext) as f |
|
|
283 | with tempfile.NamedTemporaryFile(suffix=ext) as f, \ | |
|
284 | open(os.devnull, 'w') as devnull: | |
|
282 | 285 | f.write(raw) |
|
283 | 286 | f.flush() |
|
284 | 287 | fmt = dict(file=f.name, format=imageformat) |
|
285 | 288 | args = [s.format(**fmt) for s in self.tempfile_image_handler] |
|
286 | subprocess.Popen( | |
|
287 | args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, | |
|
288 | ).communicate() | |
|
289 | subprocess.call(args, stdout=devnull, stderr=devnull) | |
|
289 | 290 | |
|
290 | 291 | def handle_image_callable(self, data, mime): |
|
291 | 292 | self.callable_image_handler(data) |
General Comments 0
You need to be logged in to leave comments.
Login now