Fix error check
This commit is contained in:
parent
d680c4efb1
commit
4dd3cb0f54
1 changed files with 4 additions and 5 deletions
|
@ -19,11 +19,10 @@ courses = dict()
|
||||||
mbzre = re.compile(r"course_(?P<courseid>\d+)_(?P<categoryid>\d+)_(?P<timestamp>\d+).mbz")
|
mbzre = re.compile(r"course_(?P<courseid>\d+)_(?P<categoryid>\d+)_(?P<timestamp>\d+).mbz")
|
||||||
|
|
||||||
def call_php(courseid: int, categoryid: int, timestamp: int):
|
def call_php(courseid: int, categoryid: int, timestamp: int):
|
||||||
try:
|
response = subprocess.run(["php", config["IMPORTER"]["PHPScript"], f"--courseid={courseid}", f"--categoryid={categoryid}", f"--timestamp={timestamp}"], cwd=Path(config["IMPORTER"]["PHPScript"]).parent, capture_output=True, encoding="utf8")
|
||||||
subprocess.run(["php", config["IMPORTER"]["PHPScript"], f"--courseid={courseid}", f"--categoryid={categoryid}", f"--timestamp={timestamp}"], cwd=Path(config["IMPORTER"]["PHPScript"]).parent, check=True)
|
print(response.stdout)
|
||||||
return True
|
print(response.stderr)
|
||||||
except subprocess.CalledProcessError:
|
return (not response.stderr) and (not "!!!" in response.stdout)
|
||||||
return False
|
|
||||||
|
|
||||||
|
|
||||||
for mbz in source.glob("course_*_*_*.mbz"):
|
for mbz in source.glob("course_*_*_*.mbz"):
|
||||||
|
|
Loading…
Reference in a new issue