From bd3ee983289361cdefe008aed7165cae0a7188a4 Mon Sep 17 00:00:00 2001 From: Damien De Paoli Date: Sat, 7 Dec 2024 19:46:15 +1100 Subject: [PATCH] clean up start-up messages and validation on ENV. Display error correctly when exif rotater fails --- pa_job_manager.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/pa_job_manager.py b/pa_job_manager.py index f22fd06..658df9e 100644 --- a/pa_job_manager.py +++ b/pa_job_manager.py @@ -49,9 +49,14 @@ import subprocess # global debug setting -if 'ENV' not in os.environ or os.environ['ENV'] != "production": +if 'ENV' not in os.environ: DEBUG=True + print("PA job manager starting as non-production -- ENV not set! Please set ENV, I'd rather not guess what to do") +elif os.environ['ENV'] != "production": + DEBUG=True + print(f"PA job manager starting as non-production -- ENV={os.environ['ENV']}") else: + print("PA job manager starting as Production") DEBUG=False # global list of override tables to allow enumeration over them ... @@ -1933,8 +1938,11 @@ def JobTransformImage(job): out.save( e.FullPathOnFS() ) else: AddLogForJob(job, f"INFO: Rotating {e.FullPathOnFS()} by {amt} degrees" ) - p = subprocess.run([PA_EXIF_ROTATER, e.FullPathOnFS(), amt ], capture_output=True ) - PAprint(p) + p = subprocess.run([PA_EXIF_ROTATER, e.FullPathOnFS(), amt ], capture_output=True, text=True ) + if p.stderr: + PAprint(p.stderr) + else: + PAprint(p.stdout) settings = session.query(Settings).first() e.file_details.thumbnail, _ , _ = GenThumb( e.FullPathOnFS(), settings.auto_rotate ) e.file_details.hash = md5( job, e )