Fix: shutil import was inside finally block, causing NameError when shutil.move was called
This commit is contained in:
parent
c34e4aa376
commit
2e337ff079
@ -119,12 +119,17 @@ def run_subprocess_logged(cmd, job_id, step_name):
|
||||
update_job(job_id, current_step=step_name, status="processing")
|
||||
proc = subprocess.run(cmd, capture_output=True, text=True)
|
||||
if proc.returncode != 0:
|
||||
# Combine stdout + stderr za diagnostiko
|
||||
err_msg = (proc.stderr or "") + "\n" + (proc.stdout or "")
|
||||
update_job(
|
||||
job_id,
|
||||
status="failed",
|
||||
error=f"{step_name}: {proc.stderr[-500:]}",
|
||||
error=f"{step_name}: {err_msg[-800:].strip()}",
|
||||
)
|
||||
return False
|
||||
# Tudi pri success-u beleži stderr za diagnostiko (samo zadnji del)
|
||||
if proc.stderr and proc.stderr.strip():
|
||||
update_job(job_id, last_step_log=proc.stderr[-500:].strip())
|
||||
return True
|
||||
|
||||
|
||||
|
||||
@ -13,6 +13,7 @@ Primer:
|
||||
python3 clip.py input.mp4 out_dir/ --clips "0:30-1:00,2:15-2:45,5:00-5:30" --lang sl
|
||||
"""
|
||||
import argparse
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import os
|
||||
@ -85,7 +86,6 @@ def run_clip(src, dst, start, duration, mode, lang, model, style, no_subs, quali
|
||||
shutil.move(str(reframed), str(dst))
|
||||
return True
|
||||
finally:
|
||||
import shutil
|
||||
shutil.rmtree(tmp, ignore_errors=True)
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user