Skip to content
This repository has been archived by the owner on Aug 21, 2020. It is now read-only.

Commit

Permalink
More python backwards compatability changes
Browse files Browse the repository at this point in the history
  • Loading branch information
simoncadman committed Dec 1, 2012
1 parent 2a82cc7 commit b24f713
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions printer.py
Expand Up @@ -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://'
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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.