diff options
author | Matthias Wachs <wachs@net.in.tum.de> | 2013-12-06 12:12:09 +0000 |
---|---|---|
committer | Matthias Wachs <wachs@net.in.tum.de> | 2013-12-06 12:12:09 +0000 |
commit | f1b32958e42714ef3200563493f15dc698d837c2 (patch) | |
tree | 507cbe3227ce8253ebef95734b58eab26151edf9 | |
parent | 85fd71464332610eb7cb6a97a946b085e791d3d5 (diff) |
detect python interpreter
error handling
-rw-r--r-- | src/util/Makefile.am | 5 | ||||
-rwxr-xr-x | src/util/gnunet-qr.py.in (renamed from src/util/gnunet-qr) | 11 |
2 files changed, 12 insertions, 4 deletions
diff --git a/src/util/Makefile.am b/src/util/Makefile.am index 851b4b521a..5cd61ddcfa 100644 --- a/src/util/Makefile.am +++ b/src/util/Makefile.am @@ -137,6 +137,11 @@ bin_PROGRAMS = \ $(GNUNET_ECC) \ gnunet-uri +do_subst = $(SED) -e 's,[@]PYTHON[@],$(PYTHON),g' + +gnunet-qr: gnunet-qr.py.in Makefile + $(do_subst) < gnunet-qr.py.in > gnunet-qr + chmod +x gnunet-qr gnunet_service_resolver_SOURCES = \ gnunet-service-resolver.c diff --git a/src/util/gnunet-qr b/src/util/gnunet-qr.py.in index a025d04797..086f6ae84e 100755 --- a/src/util/gnunet-qr +++ b/src/util/gnunet-qr.py.in @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!@PYTHON@ import sys import getopt from sys import argv @@ -31,11 +31,10 @@ if __name__ == '__main__': device = '/dev/video0' for o,a in opts: if o in ("-h", "--help"): - help () + help () sys.exit (0) elif o in ("-d", "--device"): device = a - # create a Processor proc = zbar.Processor() @@ -43,7 +42,11 @@ if __name__ == '__main__': proc.parse_config('enable') # initialize the Processor - proc.init(device) + try: + proc.init(device) + except Exception as e: + print 'Failed to open device ' + device + exit (1) # enable the preview window proc.visible = True |