jenom / pdfbook2

Create booklets from PDF files
GNU General Public License v3.0
57 stars 11 forks source link

add process ID to temp file name to enable parallelised call of pdfbook #8

Open cryptointerest opened 3 years ago

cryptointerest commented 3 years ago

When attempting to use pdfbook2 on multiple files simulataneously in a parallelised bash script, pdfbook2 throws a file not found error in line 161 because each launched process uses the same file name for the temporary file. This is defined in line 41: 41 tmpFile = ".crop-tmp.pdf" Adding the process ID to this temporary file fixes the issue. I suggest replacing line 41 by 41 tmpFile = f".{os.getpid()}.crop-tmp.pdf" In this way each of the temporary files is unique to each process.