Permalink
Browse files

More python backwards compatability changes

  • Loading branch information...
simoncadman committed Dec 1, 2012
1 parent 2a82cc7 commit b24f713501ece4474d379d600d1f6188dfe239d5
Showing with 6 additions and 8 deletions.
  1. +6 −8 printer.py
View
@@ -17,7 +17,7 @@
from auth import Auth
from urlparse import urlparse
-class Printer():
+class Printer:
BOUNDARY = mimetools.choose_boundary()
CRLF = '\r\n'
PROTOCOL = 'cloudprint://'
@@ -92,7 +92,7 @@ def addPrinter( self, printername, uri, connection ) :
connection.enablePrinter(printername)
connection.acceptJobs(printername)
connection.setPrinterShared(printername, False)
- except Exception as error:
+ except Exception , error:
result = error
if result == None:
print("Added " + printername)
@@ -172,9 +172,8 @@ def readFile(self, pathname):
s = f.read()
except IOError, e:
print('ERROR: Error reading %s\n%s', pathname, e)
- finally:
- f.close()
- return s
+ f.close()
+ return s
except IOError, e:
print('ERROR: Error opening %s\n%s', pathname, e)
return None
@@ -196,8 +195,7 @@ def writeFile(self, file_name, data):
f.write(data)
except IOError, e:
status = False
- finally:
- f.close()
+ f.close()
except IOError, e:
status = False
@@ -353,6 +351,6 @@ def submitJob(self, printerid, jobtype, jobfile, jobname, printername ):
print('ERROR: Print job %s failed with %s', jobtype, responseobj['message'])
return False
- except Exception as error_msg:
+ except Exception, error_msg:
print('ERROR: Print job %s failed with %s', jobtype, error_msg)
return False

0 comments on commit b24f713

Please sign in to comment.