From 2791ecc167b5f5ba94b7a56cf155f2217d2f8309 Mon Sep 17 00:00:00 2001 From: slush Date: Fri, 3 Aug 2012 16:05:47 +0200 Subject: [PATCH] Added check if video device is available --- lib/qrscanner.py | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/lib/qrscanner.py b/lib/qrscanner.py index eb3571a..bbf11c5 100644 --- a/lib/qrscanner.py +++ b/lib/qrscanner.py @@ -11,6 +11,14 @@ from urlparse import urlparse, parse_qs def is_available(): if not zbar: return False + + try: + proc = zbar.Processor() + proc.init() + except zbar.SystemError: + # Cannot open video device + return False + return True def scan_qr(): -- 1.7.1