Skip to content

Commit

Permalink
Run_all_examples script hardened, against calling from outside of par…
Browse files Browse the repository at this point in the history
…ent folder.
  • Loading branch information
clemens-fricke committed Sep 7, 2023
1 parent 197cb9b commit 7f92923
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions examples/run_all_examples.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
"""Call all *.py files in the working directory.
"""
import glob
import pathlib
import subprocess
import sys

if __name__ == "__main__":
files_not_completed = []

for file in glob.glob("*.py"):
if file == "run_all_examples.py":
for file in glob.glob(str(pathlib.Path(__file__).parent) + "/*.py"):
if file.split("/")[-1] == "run_all_examples.py":
continue
print(f"Calling {file}")
proc_return = subprocess.run([sys.executable, file])
Expand Down

0 comments on commit 7f92923

Please sign in to comment.