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")
|
||||
|
||||
def call_php(courseid: int, categoryid: int, timestamp: int):
|
||||
try:
|
||||
subprocess.run(["php", config["IMPORTER"]["PHPScript"], f"--courseid={courseid}", f"--categoryid={categoryid}", f"--timestamp={timestamp}"], cwd=Path(config["IMPORTER"]["PHPScript"]).parent, check=True)
|
||||
return True
|
||||
except subprocess.CalledProcessError:
|
||||
return False
|
||||
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")
|
||||
print(response.stdout)
|
||||
print(response.stderr)
|
||||
return (not response.stderr) and (not "!!!" in response.stdout)
|
||||
|
||||
|
||||
for mbz in source.glob("course_*_*_*.mbz"):
|
||||
|
|
Loading…
Reference in a new issue