fall back to default value if modules are not available (#199)

* fcntl is not available on Windows, fall back to default value

* nipick order
This commit is contained in:
James Xu 2019-01-28 15:21:26 -08:00 committed by Dirk Thomas
parent 651c997e60
commit 60910eff26
1 changed files with 2 additions and 0 deletions

View File

@ -256,6 +256,8 @@ class Printer:
s = struct.pack('HHHH', 0, 0, 0, 0) s = struct.pack('HHHH', 0, 0, 0, 0)
x = fcntl.ioctl(1, termios.TIOCGWINSZ, s) x = fcntl.ioctl(1, termios.TIOCGWINSZ, s)
width = struct.unpack('HHHH', x)[1] width = struct.unpack('HHHH', x)[1]
except ImportError:
pass
except IOError: except IOError:
pass pass
if width <= 0: if width <= 0: