X-Git-Url: https://git.mdrn.pl/librarian.git/blobdiff_plain/83cae63af4330912cdb2546c195af2919afd30ac..67a177f2ec1fa2eac56e7fb07ccaf32bcd33d8ce:/src/librarian/pdf.py?ds=sidebyside diff --git a/src/librarian/pdf.py b/src/librarian/pdf.py index cad66a4..a025b9b 100644 --- a/src/librarian/pdf.py +++ b/src/librarian/pdf.py @@ -320,8 +320,8 @@ def transform(wldoc, verbose=False, save_tex=None, morefloats=None, base_url, ilustr.get('src') ) - with six.moves.urllib.request.urlopen(url) as imgfile: - img = Image.open(imgfile) + imgfile = six.moves.urllib.request.urlopen(url) + img = Image.open(imgfile) th_format, ext, media_type = { 'GIF': ('GIF', 'gif', 'image/gif'), @@ -338,6 +338,8 @@ def transform(wldoc, verbose=False, save_tex=None, morefloats=None, th.save(os.path.join(temp, file_name)) ilustr.set('src', file_name) + imgfile.close() + for sponsor in book_info.sponsors: ins = etree.Element("data-sponsor", name=sponsor) logo = sponsor_logo(sponsor)