]> code.delx.au - webdl/blobdiff - autosocks.py
Improved README
[webdl] / autosocks.py
index 329f0736a3c95ab62bcb53ae75323a045b50bbef..5738c8c9d095f62febb295e91f147beebe9ead8e 100644 (file)
@@ -1,5 +1,6 @@
+import logging
+import os
 import subprocess
-import sys
 
 
 def detect_gnome():
@@ -60,8 +61,8 @@ def configure_socks(host, port):
     try:
         import socks, socket
     except ImportError:
-        print >>sys.stderr, "Failed to use configured SOCKS proxy:", host, port
-        print >>sys.stderr, "Try installing SocksiPy: http://socksipy.sf.net"
+        logging.error("Failed to use configured SOCKS proxy: %s:%s", host, port)
+        logging.error("Try installing SocksiPy: http://socksipy.sf.net")
         return False
 
     socket.socket = socks.socksocket
@@ -80,7 +81,7 @@ def try_autosocks():
         host, port = None, None
         try:
             host, port = func()
-        except Exception, e:
+        except Exception as e:
             pass
         if host is not None and port is not None:
             return configure_socks(host, port)