Permalink
Browse files

Fix for issue #7 - backend script fails if cannot write to logfile

  • Loading branch information...
simoncadman committed May 13, 2012
1 parent 52410ef commit eb1b2dcfe9bfffe0f0933a32e7d8bd461a719a67
Showing with 6 additions and 1 deletion.
  1. +6 −1 backend.py
View
@@ -67,7 +67,12 @@ def fileIsPDF ( filename ) :
sys.stdout.write("URI must be \"cloudprint:/<cloud printer name>\"!\n")
sys.exit(255)
-logfile = open('/var/log/cups/cloudprint_log', 'a')
+try:
+ logfile = open('/var/log/cups/cloudprint_log', 'a')
+except:
+ logfile = sys.stdout
+ logfile.write("Unable to write to log file /var/log/cups/cloudprint_log")
+
logfile.write("Printing file " + printFile + "\n")
def which(program):

0 comments on commit eb1b2dc

Please sign in to comment.