pyfpdf icon indicating copy to clipboard operation
pyfpdf copied to clipboard

image loading from url does not work - with quick and dirty fix

Open asl5757 opened this issue 6 years ago • 0 comments

I tried to open an existing image from an URL and produced the follwing error message:

File "C:\CAE\Python\lib\site-packages\fpdf\image_parsing.py", line 23, in load_resource
    f = BytesIO(urlopen(filename).read())
NameError: name 'urlopen' is not defined

My fix for this is this patch to image_parsing.py:

6a7,8
> # without this line images cannot be loaded from URLs (tested with Python 3.8)
> from urllib.request import urlopen

asl5757 avatar Jan 30 '20 14:01 asl5757