Mercurial > hg > zebra
diff zebra.py @ 26:20f6df6d3f42
- Fix for empty printer list
- Updated to 0.0.4a
- Altered to use pip
author | Ben Croston <ben@croston.org> |
---|---|
date | Sat, 16 Nov 2013 17:17:15 +0000 |
parents | fc1a7cf3f92c |
children | 7c132e01c281 |
line wrap: on
line diff
--- a/zebra.py Wed Aug 31 16:46:48 2011 +0100 +++ b/zebra.py Sat Nov 16 17:17:15 2013 +0000 @@ -1,6 +1,6 @@ #!/usr/bin/env python -# Copyright (c) 2011 Ben Croston +# Copyright (c) 2011-2013 Ben Croston # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Software"), to deal in @@ -60,7 +60,7 @@ win32print.EndDocPrinter(hPrinter) finally: win32print.ClosePrinter(hPrinter) - + def output(self, commands): """Output EPL2 commands to the label printer @@ -79,7 +79,10 @@ def _getqueues_unix(self): queues = [] - output = subprocess.check_output(['lpstat','-p'], universal_newlines=True) + try: + output = subprocess.check_output(['lpstat','-p'], universal_newlines=True) + except subprocess.CalledProcessError: + return [] for line in output.split('\n'): if line.startswith('printer'): queues.append(line.split(' ')[1])