diff options
-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 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 | ||
140 | do_subst = $(SED) -e 's,[@]PYTHON[@],$(PYTHON),g' | ||
141 | |||
142 | gnunet-qr: gnunet-qr.py.in Makefile | ||
143 | $(do_subst) < gnunet-qr.py.in > gnunet-qr | ||
144 | chmod +x gnunet-qr | ||
140 | 145 | ||
141 | gnunet_service_resolver_SOURCES = \ | 146 | gnunet_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@ |
2 | import sys | 2 | import sys |
3 | import getopt | 3 | import getopt |
4 | from sys import argv | 4 | from 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 |