g-raffy / pymusco

a python application to manage digitised orchestral musical scores
GNU General Public License v3.0
3 stars 1 forks source link

corrupt images in stub pdf #1

Open g-raffy opened 6 years ago

g-raffy commented 6 years ago

sometimes, one page of the resulting stub pdf contains a corrupted image (the bottom part contains wring pixel values).

The input images are not corrupted though. The corruption happens during the pdflatex part. Double check that the input images are completely written at the moment they are used as input

g-raffy commented 6 years ago

added a function that checks the integrity of a pdf file. This helped me to discover that the corruption seems to be caused by subprocess.check_call, which seems to not wait for the completion of the command before carrying on, as should be expected.

I replaced subprocess.check_call with subprocess.Popen + wait(), which seems to work better. For security, I added a call to detect malformed pdf in the case this fix doesn't prove to work 100%.

g-raffy commented 6 years ago

replacing subprocess.check_call with subprocess.Popen didn't fix this bug : I just had a corrupt pdf again