@@ -975,24 +975,21 @@ def handle_image_stream(self, data, mime):
975
975
imageformat = self ._imagemime [mime ]
976
976
fmt = dict (format = imageformat )
977
977
args = [s .format (** fmt ) for s in self .stream_image_handler ]
978
- with open (os .devnull , 'w' ) as devnull :
979
- proc = subprocess .Popen (
980
- args , stdin = subprocess .PIPE ,
981
- stdout = devnull , stderr = devnull )
978
+ with subprocess .Popen (args , stdin = subprocess .PIPE ,
979
+ stdout = subprocess .DEVNULL , stderr = subprocess .DEVNULL ) as proc :
982
980
proc .communicate (raw )
983
- return (proc .returncode == 0 )
981
+ return (proc .returncode == 0 )
984
982
985
983
def handle_image_tempfile (self , data , mime ):
986
984
raw = base64 .decodebytes (data [mime ].encode ('ascii' ))
987
985
imageformat = self ._imagemime [mime ]
988
986
filename = 'tmp.{0}' .format (imageformat )
989
- with NamedFileInTemporaryDirectory (filename ) as f , \
990
- open (os .devnull , 'w' ) as devnull :
987
+ with NamedFileInTemporaryDirectory (filename ) as f :
991
988
f .write (raw )
992
989
f .flush ()
993
990
fmt = dict (file = f .name , format = imageformat )
994
991
args = [s .format (** fmt ) for s in self .tempfile_image_handler ]
995
- rc = subprocess .call (args , stdout = devnull , stderr = devnull )
992
+ rc = subprocess .call (args , stdout = subprocess . DEVNULL , stderr = subprocess . DEVNULL )
996
993
return (rc == 0 )
997
994
998
995
def handle_image_callable (self , data , mime ):
0 commit comments