Commits

Eric Johnson  committed 26cbabd

minor modifications to handle changes to print and except for python3.2

  • Participants
  • Parent commits a65ab46

Comments (0)

Files changed (2)

File src/bbi/commands.py

 def pprint_issue(issue, verbose=True):
     lines = format_issue(issue, verbose)
     lines.insert(0, " ") # insert empty first line
-    print "\n".join(lines)
+    print("\n".join(lines))
 
 
 def handle_error(result):
             try:
                 browser.open(issues_url)
             except:
-                print "error: opening page in web browser failed"
+                print("error: opening page in web browser failed")
             else:
                 sys.exit(0)
 
             try:
                 browser.open(issue_url)
             except:
-                print "error: opening page in web browser failed"
+                print("error: opening page in web browser failed")
             else:
                 sys.exit(0)
                 
         closing_state = closing_states.get(cs)
         issue = self.__submit(number, data={'status': closing_state},
             method='PUT')
-        print "set issue %s status to %s" % (number, closing_state)
+        print("set issue %s status to %s" % (number, closing_state))
 
         
     def open(self, number=None, **kwargs):
         issue = self.__submit(number, data={'status': 'open'},
             method='PUT')
-        print "set issue %s status to open" % number
+        print("set issue %s status to open" % number)
 
         
     def remove(self, number=None, **kwargs):
         validate_number(number, example="%s remove 1" % get_prog())
         response = self.__submit(number, method='DELETE')
         if response == 'deleted':
-            print 'deleted issue %s' % number
+            print('deleted issue %s' % number)
 
 
     def search(self, search_term=None, verbose=False, **kwargs):
         if not search_term:
             example = "%s search experimental" % get_prog()
             msg = "error: search term required\nexample: %s" % example
-            print msg
+            print(msg)
             sys.exit(1)
         search_term_quoted = urllib.quote_plus(search_term)
         search_term_quoted = search_term_quoted.replace(".", "%2E")
         getattr(commands, cmd)(*args[1:], **kwargs)
     except AttributeError:
         return "error: command '%s' not implemented" % cmd
-    except Exception, info:
+    except Exception as info:
         return "error: %s" % info
 
 

File src/bbi/utils.py

         if method == 'PUT' or method == 'DELETE':
             request.get_method = lambda: method
         return opener.open(request)
-    except urllib2.HTTPError, info:
+    except urllib2.HTTPError as info:
         raise Exception("server problem (%s)" % info)
     except urllib2.URLError:
         raise Exception("connection problem")
                 # a bit hackish: hg paths <path> returns 'not found!' when
                 # <path> is not in .hg/hgrc; this is to avoid showing it
                 if not 'not found' in line:
-                    print line
+                    print(line)
     raise Exception("not a valid repository or not hosted on Bitbucket")
 
 
     config = {}
     try:
         f = open(config_file, 'r')
-    except IOError, info:
+    except IOError as info:
         raise Exception("config file (%s) not found" % config_file)
     else:
         for line in f.readlines():
     command = "%s %s" % (editor, f.name)
     ret = subprocess.call(command, shell=True)
     if ret != 0:
-        print "error: editor command failed"
+        print("error: editor command failed")
         sys.exit(1)
 
     changed_text = open(f.name).read()