I just reinstalled OS X 10.5 Leopard on my laptop and restored my data/applications from a Time Machine backup. When I use urllib.urlopen() I get the following error:

>>> import urllib
>>> u=urllib.urlopen(aUrl)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/urllib.py", line 82, in urlopen
    return opener.open(url)
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/urllib.py", line 190, in open
    return getattr(self, name)(url)
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/urllib.py", line 325, in open_http
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/httplib.py", line 860, in endheaders
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/httplib.py", line 732, in _send_output
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/httplib.py", line 699, in send
  File "/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/httplib.py", line 683, in connect
    raise socket.error, msg
IOError: [Errno socket error] (61, 'Connection refused')

This is so weird. I did nothing else. It was working normally before I did the reinstall. I even installed Python 2.5.4 from python.org and the same thing happens. Does anyone know what could be causing this?

Thanks in advance.

Just a WAG, but it looks like you changed your OS permission/access level.

I have found the answer. I had an http proxy (GlimmerBlocker) running. For whatever reason this program was not restored correctly.