From b60e540de56455a515ff0646cabb1acbf27d120b Mon Sep 17 00:00:00 2001 From: Romain Porte Date: Mon, 22 May 2017 23:16:25 +0200 Subject: [PATCH] Parse max_width to int before compare --- src/escpos/escpos.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/escpos/escpos.py b/src/escpos/escpos.py index 6f68872..b61309e 100644 --- a/src/escpos/escpos.py +++ b/src/escpos/escpos.py @@ -101,12 +101,15 @@ class Escpos(object): im = EscposImage(img_source) 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: raise ImageWidthError('{} > {}'.format(im.width, max_width)) except KeyError: # If the printer's pixel width is not known, print anyways... pass + except ValueError: + # If the max_width cannot be converted to an int, print anyways... + pass if im.height > fragment_height: fragments = im.split(fragment_height)