aboutsummaryrefslogtreecommitdiff
path: root/src/util
diff options
context:
space:
mode:
authorMatthias Wachs <wachs@net.in.tum.de>2013-12-06 12:12:09 +0000
committerMatthias Wachs <wachs@net.in.tum.de>2013-12-06 12:12:09 +0000
commitf1b32958e42714ef3200563493f15dc698d837c2 (patch)
tree507cbe3227ce8253ebef95734b58eab26151edf9 /src/util
parent85fd71464332610eb7cb6a97a946b085e791d3d5 (diff)
downloadgnunet-f1b32958e42714ef3200563493f15dc698d837c2.tar.gz
gnunet-f1b32958e42714ef3200563493f15dc698d837c2.zip
detect python interpreter
error handling
Diffstat (limited to 'src/util')
-rw-r--r--src/util/Makefile.am5
-rwxr-xr-xsrc/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 851b4b521..5cd61ddcf 100644
--- a/src/util/Makefile.am
+++ b/src/util/Makefile.am
@@ -137,6 +137,11 @@ bin_PROGRAMS = \
137 $(GNUNET_ECC) \ 137 $(GNUNET_ECC) \
138 gnunet-uri 138 gnunet-uri
139 139
140do_subst = $(SED) -e 's,[@]PYTHON[@],$(PYTHON),g'
141
142gnunet-qr: gnunet-qr.py.in Makefile
143 $(do_subst) < gnunet-qr.py.in > gnunet-qr
144 chmod +x gnunet-qr
140 145
141gnunet_service_resolver_SOURCES = \ 146gnunet_service_resolver_SOURCES = \
142 gnunet-service-resolver.c 147 gnunet-service-resolver.c
diff --git a/src/util/gnunet-qr b/src/util/gnunet-qr.py.in
index a025d0479..086f6ae84 100755
--- a/src/util/gnunet-qr
+++ b/src/util/gnunet-qr.py.in
@@ -1,4 +1,4 @@
1#!/usr/bin/python 1#!@PYTHON@
2import sys 2import sys
3import getopt 3import getopt
4from sys import argv 4from sys import argv
@@ -31,11 +31,10 @@ if __name__ == '__main__':
31 device = '/dev/video0' 31 device = '/dev/video0'
32 for o,a in opts: 32 for o,a in opts:
33 if o in ("-h", "--help"): 33 if o in ("-h", "--help"):
34 help () 34 help ()
35 sys.exit (0) 35 sys.exit (0)
36 elif o in ("-d", "--device"): 36 elif o in ("-d", "--device"):
37 device = a 37 device = a
38
39 # create a Processor 38 # create a Processor
40 proc = zbar.Processor() 39 proc = zbar.Processor()
41 40
@@ -43,7 +42,11 @@ if __name__ == '__main__':
43 proc.parse_config('enable') 42 proc.parse_config('enable')
44 43
45 # initialize the Processor 44 # initialize the Processor
46 proc.init(device) 45 try:
46 proc.init(device)
47 except Exception as e:
48 print 'Failed to open device ' + device
49 exit (1)
47 50
48 # enable the preview window 51 # enable the preview window
49 proc.visible = True 52 proc.visible = True