]> code.delx.au - bg-scripts/blobdiff - randombg.py
Added support for python2.3
[bg-scripts] / randombg.py
index 3deac9cdec948147cc46670d0ca55f0ba3b19da0..bb2936b29bee4c72ab1436eb29c75a81b17e6854 100755 (executable)
@@ -7,7 +7,12 @@ import asyncore, asynchat, socket
 import os, os.path, random, sys, time
 from optparse import OptionParser
 import logging
-logging.basicConfig(format="%(levelname)s: %(message)s")
+try:
+       logging.basicConfig(format="%(levelname)s: %(message)s")
+except TypeError:
+# Python 2.3's logging.basicConfig does not support parameters
+       logging.basicConfig()
+
 try:
        import cPickle as pickle
 except ImportError:
@@ -18,7 +23,7 @@ try:
        import asyncsched
        import wallchanger
 except ImportError, e:
-       logging.critical("Missing libraries! Exiting...")
+       logging.critical("Missing libraries! Exiting...", exc_info=1)
        sys.exit(1)
 
 
@@ -147,7 +152,7 @@ class AllRandomFileList(BaseFileList):
        def store_cache(self, filename):
                try:
                        fd = open(filename, 'wb')
-                       pickle.dump(obj = self, file = fd, protocol = 2)
+                       pickle.dump(self, fd, 2)
                        logging.debug("Cache successfully stored")
                except Exception, e:
                        logging.warning("Storing cache", exc_info=1)