[Python-bugs-list] [ python-Bugs-445928 ] UnboundLocalError in httplib.py

noreply@sourceforge.net noreply@sourceforge.net
Mon, 30 Jul 2001 07:43:32 -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: 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