Skip to content

Commit 18c8735

Browse files
committed
Fix run_examples.py on Windows
1 parent d1c7266 commit 18c8735

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

tools/run_examples.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
import importlib
1616
import os
17+
import subprocess
1718
import sys
1819

1920

@@ -189,9 +190,10 @@ def check_installed_packages():
189190
def check_gi_installed():
190191
# Cannot import both gtk and gi in the same script, thus
191192
# need another way of checking if gi package is installed.
192-
command = ("\"{python}\" -c \"import gi\""
193-
.format(python=sys.executable))
194-
code = os.system(command)
193+
code = subprocess.call([sys.executable, "-c", "import gi"])
194+
if code != 0:
195+
print("[run_examples.py] gi module not found (PyGI / GTK 3).")
196+
print(" Import error above can be safely ignored.")
195197
return True if code == 0 else False
196198

197199

0 commit comments

Comments
 (0)