-fix the fix
[oweals/gnunet.git] / src / util / gnunet-qr.py.in
index 6f6118b28c955cb930265dc12fde535552ecfc7b..ced7a5441155a0222c8ddcaa0c3506b6ef9155f9 100755 (executable)
@@ -1,13 +1,13 @@
-#@PYTHON@
+#!@PYTHON@
 import sys
 import getopt
 import subprocess
 from sys import argv
 try:
-    import zbar
+       import zbar
 except ImportError as e:
-    print 'Cannot run gnunet-qr, please install zbar-python'
-    sys.exit (1)
+       print 'Cannot run gnunet-qr, please install zbar-python'
+       sys.exit (1)
 
 def help ():
  print 'gnunet-qr\n\
@@ -36,7 +36,6 @@ if __name__ == '__main__':
                help ()
                print str (e)
                exit (1)
-       print "asdsa"
        for o,a in opts:
                if o in ("-h", "--help"):
                        help ()            
@@ -49,7 +48,7 @@ if __name__ == '__main__':
                        silent = True
                elif o in ("-v", "--verbose"):
                        verbose = True                  
-       id (True == verbose):
+       if (True == verbose):
                print 'Initializing'
        # create a Processor
        proc = zbar.Processor()
@@ -59,7 +58,7 @@ if __name__ == '__main__':
 
        # initialize the Processor
        try:
-               id (True == verbose):
+               if (True == verbose):
                        print 'Opening video device ' + device
                proc.init(device)
        except Exception as e:
@@ -75,7 +74,7 @@ if __name__ == '__main__':
        proc.visible = True
        # read at least one barcode (or until window closed)
        try:
-               id (True == verbose):
+               if (True == verbose):
                        print 'Capturing'
                proc.process_one()
        except Exception as e:
@@ -99,9 +98,11 @@ if __name__ == '__main__':
                for a in args:
                        cmd += " " + str(a)
                if (verbose):
-                       print 'Running ' + cmd
+                       print 'Running `' + cmd +'`'
                res=subprocess.call(args)
                if (0 != res):
-                       print 'Failed to '
+                       print 'Failed to add URI ' + str(symbol.data)
+               else: 
+                       print 'Added URI ' + str(symbol.data)
                exit (res)
        exit (1)