Převod PDF→PNG pomocí subprocess.run a s lepší chybovou hláškou.
Nevím, jak na produkci, ale v debug módu je chybová hláška vidět v lokálních proměnných.
This commit is contained in:
		
							parent
							
								
									dbeee70f54
								
							
						
					
					
						commit
						a452cc73f0
					
				
					 1 changed files with 5 additions and 2 deletions
				
			
		|  | @ -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) | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue
	
	 Pavel "LEdoian" Turinsky
						Pavel "LEdoian" Turinsky