1
0
Fork 0
forked from josch/img2pdf

If input to convert() doesn't have a write() member, then it must be str or bytes type

This commit is contained in:
Johannes 'josch' Schauer 2017-01-19 20:32:46 +01:00
parent 7c90b2c451
commit f94684c8ea

View file

@ -1005,6 +1005,9 @@ def convert(*images, title=None,
try:
rawdata = img.read()
except AttributeError:
if not isinstance(img, (str, bytes)):
raise TypeError(
"Neither implements read() nor is str or bytes")
# the thing doesn't have a read() function, so try if we can treat
# it as a file name
try: