changeset 92:bc1753ff9b8b

i hate software
author Jeff Hammel <jhammel@mozilla.com>
date Mon, 11 Feb 2013 13:38:10 -0800
parents 56ac8bd08fa0
children 5c04cf601aba
files bitsyblog/blogme.py setup.py
diffstat 2 files changed, 9 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/bitsyblog/blogme.py	Sat Sep 01 01:45:56 2012 -0700
+++ b/bitsyblog/blogme.py	Mon Feb 11 13:38:10 2013 -0800
@@ -3,6 +3,7 @@
 command line blogger
 """
 
+import datetime
 import optparse
 import os
 import subprocess
@@ -144,9 +145,15 @@
             connection = urllib2.urlopen(url, data=msg)
             print connection.url # print the blog post's url
             break
-        except (urllib2.HTTPError, urllib2.URLError), e:
+        except (urllib2.HTTPError, urllib2.URLError, socket.error), e:
             continue
+        except:
+            print >> sys.stderr, "An error has occured:"
+            print >> sys.stderr, sys.exc_info() # XXX pretty crappy
+            break
     else:
+        with file('blog-%s.txt' % datetime.datetime.now().strftime("%Y%m%d"), 'w') as f:
+            f.write(msg)
         print >> sys.stderr, e
         print msg
 
--- a/setup.py	Sat Sep 01 01:45:56 2012 -0700
+++ b/setup.py	Mon Feb 11 13:38:10 2013 -0800
@@ -1,7 +1,7 @@
 from setuptools import setup, find_packages
 import sys, os
 
-version = '2.4.2'
+version = '2.4.3'
 
 try:
     description = file('README.txt').read()