[Python-bugs-list] [ python-Bugs-445928 ] UnboundLocalError in httplib.py
noreply@sourceforge.net
noreply@sourceforge.net
Mon, 30 Jul 2001 10:39:06 -0700
Bugs item #445928, was opened at 2001-07-30 05:35
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=445928&group_id=5470
Category: Python Library
Group: Python 2.2
Status: Open
Resolution: None
Priority: 5
Submitted By: Just van Rossum (jvr)
Assigned to: Martin v. Löwis (loewis)
Summary: UnboundLocalError in httplib.py
Initial Comment:
Python 2.2a0 (#1, 07/30/01, 13:21:09)
[GCC Apple DevKit-based CPP 6.0alpha] on darwin1
Type "help", "copyright", "credits" or "license" for
more information.
>>> import urllib
>>> f = urllib.urlopen("http://www.letterror.com/")
Traceback (most recent call last):
File "<stdin>", line 1, in ?
File "/usr/local/lib/python2.2/urllib.py", line 71, in
urlopen
return _urlopener.open(url)
File "/usr/local/lib/python2.2/urllib.py", line 176,
in open
return getattr(self, name)(url)
File "/usr/local/lib/python2.2/urllib.py", line 283,
in open_http
h.putrequest('GET', selector)
File "/usr/local/lib/python2.2/httplib.py", line 449,
in putrequest
self.send(str)
File "/usr/local/lib/python2.2/httplib.py", line 391,
in send
self.connect()
File "/usr/local/lib/python2.2/httplib.py", line 375,
in connect
raise socket.error, msg
UnboundLocalError: local variable 'msg' referenced
before assignment
>>>
----------------------------------------------------------------------
>Comment By: Guido van Rossum (gvanrossum)
Date: 2001-07-30 10:39
Message:
Logged In: YES
user_id=6380
But even if getaddrinfo() returns an empty list, this error
should not occur. You may have to initialize msg to
something and do something differently at the end when msg
is still None.
----------------------------------------------------------------------
Comment By: Martin v. Löwis (loewis)
Date: 2001-07-30 08:42
Message:
Logged In: YES
user_id=21627
It appears that Darwin does provide getaddrinfo. I'm not
sure why it doesn't work.
----------------------------------------------------------------------
Comment By: Just van Rossum (jvr)
Date: 2001-07-30 07:43
Message:
Logged In: YES
user_id=92689
socketmodule.c: 1.157
getaddrinfo.c: 1.6
socket.getaddrinfo('www.letterror.com',80,0,socket.SOCK_STREA
M) indeed returns an empty list.
I can try to give you access, but I'll have to fiddle with
permissions.
----------------------------------------------------------------------
Comment By: Martin v. Löwis (loewis)
Date: 2001-07-30 07:16
Message:
Logged In: YES
user_id=21627
Can you please indicate what version of socketmodule.c and
getaddrinfo.c was used for this build?
Please report the result of
import socket
socket.getaddrinfo('www.letterror.com',80,0,socket.SOCK_STREAM)
It should be something like
[(2, 2, 0, '', ('216.218.226.21', 80))]
If it is an empty list (as it appears from the error
message), can you please try step through
PySocket_getaddrinfo with a debugger and analyse why it
doesn't find out the IP address? If not, is there a chance
to get access to such a machine to debug it myself remotely?
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=445928&group_id=5470