
On 25.05.2017 17:40, Hermann Riemann wrote:
error=os.system("latex ... 2> /tmp/log")
Hermann der das so machen würde
Sieht durchaus einfacher aus, ist aber nicht ganz unsicher, wenn's um das Thema Quoting von Parametern geht. *Hier auch noch zum Nachlesen:* https://docs.python.org/3.6/library/subprocess.html The subprocess module allows you to spawn new processes, connect to their input/output/error pipes, and obtain their return codes. This module *intends to replace* several older modules and functions: os.system os.spawn* *Überspitzt ausgedrückt:* subprocess ist der neue heiße Scheiß und os.system/os.popen der Schnee von gestern. ;-) Daher empfehle auch ich, wie Volker: try: output = subprocess.check_output(.......) except subprocess.CalledProcessError as exc: # hier geht's zur Fehlerbehandlung, falls latex streikt print(exc.output) else: # alles gut print(output) Das funktioniert sowohl unter Python 2 als auch Python 3. Viel Erfolg damit. :) Grüße, Sven