From a452cc73f07389bee90c419ed1d8db633a700f37 Mon Sep 17 00:00:00 2001 From: "Pavel \"LEdoian\" Turinsky" Date: Tue, 23 Mar 2021 19:42:25 +0100 Subject: [PATCH] =?UTF-8?q?P=C5=99evod=20PDF=E2=86=92PNG=20pomoc=C3=AD=20s?= =?UTF-8?q?ubprocess.run=20a=20s=20lep=C5=A1=C3=AD=20chybovou=20hl=C3=A1?= =?UTF-8?q?=C5=A1kou.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Nevím, jak na produkci, ale v debug módu je chybová hláška vidět v lokálních proměnných. --- seminar/models.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/seminar/models.py b/seminar/models.py index b7147106..63c9bdfa 100644 --- a/seminar/models.py +++ b/seminar/models.py @@ -601,7 +601,7 @@ class Cislo(SeminarModelBase): if not self.titulka_nahled or os.path.getmtime(self.titulka_nahled.path) < os.path.getmtime(self.pdf.path): png_filename = pathlib.Path(tempfile.mkdtemp(), 'nahled.png') - subprocess.call([ + subprocess.run([ "convert", "-density", "300x300", "-geometry", "{}x{}".format(VYSKA, sirka), @@ -609,7 +609,10 @@ class Cislo(SeminarModelBase): "-flatten", "{}[0]".format(self.pdf.path), # titulní strana png_filename - ]) + ], + check=True, + capture_output=True + ) with open(png_filename,'rb') as f: self.titulka_nahled.save('',f,True)