If input to convert() doesn't have a write() member, then it must be str or bytes type
This commit is contained in:
parent
7c90b2c451
commit
f94684c8ea
1 changed files with 3 additions and 0 deletions
|
@ -1005,6 +1005,9 @@ def convert(*images, title=None,
|
||||||
try:
|
try:
|
||||||
rawdata = img.read()
|
rawdata = img.read()
|
||||||
except AttributeError:
|
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
|
# the thing doesn't have a read() function, so try if we can treat
|
||||||
# it as a file name
|
# it as a file name
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in a new issue