From a4dd75e5c895bdbad3c4c793d1a247aa5d296f1a Mon Sep 17 00:00:00 2001 From: Thomas Steen Rasmussen Date: Mon, 30 May 2016 18:39:05 +0200 Subject: [PATCH] open in binary mode when saving files to archive --- shop/pdf.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shop/pdf.py b/shop/pdf.py index d16560d9..57759aaa 100644 --- a/shop/pdf.py +++ b/shop/pdf.py @@ -39,7 +39,7 @@ def generate_pdf_letter(filename, template, formatdict): finalpdf.addPage(page) ### save the generated pdf to the archive - with open(settings.PDF_ARCHIVE_PATH+filename, 'w') as fh: + with open(settings.PDF_ARCHIVE_PATH+filename, 'wb') as fh: finalpdf.write(fh) print('Saved pdf to archive: %s' % settings.PDF_ARCHIVE_PATH+filename)