[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[dak/master] catch and output file write errors



---
 queue_rss.py |   14 +++++++++++---
 1 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/queue_rss.py b/queue_rss.py
index 783e5ae..9ca66ab 100755
--- a/queue_rss.py
+++ b/queue_rss.py
@@ -176,11 +176,19 @@ if __name__ == "__main__":
     feed_in_file = os.path.join(settings.outdir, inrss_filename)
     feed_out_file = os.path.join(settings.outdir, outrss_filename)
 
-    status.feed_in.write_xml(file(feed_in_file, "w+"), "utf-8")
-    status.feed_out.write_xml(file(feed_out_file, "w+"), "utf-8")
+    try:
+        status.feed_in.write_xml(file(feed_in_file, "w+"), "utf-8")
+        status.feed_out.write_xml(file(feed_out_file, "w+"), "utf-8")
+    except IOError, why:
+        sys.stderr.write("Unable to write feeds: %s\n", why)
+        sys.exit(1)
 
     status.queue = current_queue
 
-    cPickle.dump(status, open(status_db, "w+"))
+    try:
+        cPickle.dump(status, open(status_db, "w+"))
+    except IOError, why:
+        sys.stderr.write("Unable to save status: %s\n", why)
+        sys.exit(1)
 
 # vim:et:ts=4
-- 
1.5.6.5



Reply to: