Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6301cff

Browse files
committed
Only pass non-zero creation flags on windows.
1 parent bd8efbc commit 6301cff

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

lib/matplotlib/animation.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
import six
2424
from six.moves import xrange, zip
2525

26+
import platform
2627
import sys
2728
import itertools
2829
import contextlib
@@ -34,7 +35,12 @@
3435
# Process creation flag for subprocess to prevent it raising a terminal
3536
# window. See for example:
3637
# https://stackoverflow.com/questions/24130623/using-python-subprocess-popen-cant-prevent-exe-stopped-working-prompt
37-
CREATE_NO_WINDOW = 0x08000000
38+
if platform.system() == 'Windows':
39+
CREATE_NO_WINDOW = 0x08000000
40+
subprocess_creation_flags = CREATE_NO_WINDOW
41+
else:
42+
# Apparently None won't work here
43+
subprocess_creation_flags = 0
3844

3945
# Other potential writing methods:
4046
# * http://pymedia.org/
@@ -195,7 +201,7 @@ def _run(self):
195201
self._proc = subprocess.Popen(command, shell=False,
196202
stdout=output, stderr=output,
197203
stdin=subprocess.PIPE,
198-
creationflags=CREATE_NO_WINDOW)
204+
creationflags=subprocess_creation_flags)
199205

200206
def finish(self):
201207
'Finish any processing for writing the movie.'
@@ -258,7 +264,7 @@ def isAvailable(cls):
258264
shell=False,
259265
stdout=subprocess.PIPE,
260266
stderr=subprocess.PIPE,
261-
creationflags=CREATE_NO_WINDOW)
267+
creationflags=subprocess_creation_flags)
262268
p.communicate()
263269
return True
264270
except OSError:

0 commit comments

Comments
 (0)