Parse max_width to int before compare
This commit is contained in:
parent
14c7dfe58f
commit
b60e540de5
@ -101,12 +101,15 @@ class Escpos(object):
|
|||||||
im = EscposImage(img_source)
|
im = EscposImage(img_source)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
max_width = self.profile.profile_data['media']['width']['pixels']
|
max_width = int(self.profile.profile_data['media']['width']['pixels'])
|
||||||
if im.width > max_width:
|
if im.width > max_width:
|
||||||
raise ImageWidthError('{} > {}'.format(im.width, max_width))
|
raise ImageWidthError('{} > {}'.format(im.width, max_width))
|
||||||
except KeyError:
|
except KeyError:
|
||||||
# If the printer's pixel width is not known, print anyways...
|
# If the printer's pixel width is not known, print anyways...
|
||||||
pass
|
pass
|
||||||
|
except ValueError:
|
||||||
|
# If the max_width cannot be converted to an int, print anyways...
|
||||||
|
pass
|
||||||
|
|
||||||
if im.height > fragment_height:
|
if im.height > fragment_height:
|
||||||
fragments = im.split(fragment_height)
|
fragments = im.split(fragment_height)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user