[ python-Bugs-844336 ] urllib2 fails its builtin test

SourceForge.net noreply at sourceforge.net
Tue Nov 18 10:48:21 EST 2003


Bugs item #844336, was opened at 2003-11-18 21:32
Message generated for change (Comment added) made by quiver
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=844336&group_id=5470

Category: Python Library
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Colin J. Williams (cjwhrh)
Assigned to: Nobody/Anonymous (nobody)
Summary: urllib2 fails its builtin test

Initial Comment:
>python -u "ftplib.py"
Traceback (most recent call last):
  File "ftplib.py", line 803, in ?
    test()
  File "ftplib.py", line 762, in test
    while sys.argv[1] == '-d':
IndexError: list index out of range
>Exit code: 1
>python -u "urllib2.py"
gopher://gopher.lib.ncsu.edu/11/library/stacks/Alex
socket.error: (7, 'getaddrinfo failed')

gopher://gopher.vt.edu:10010/10/33
socket.error: (7, 'getaddrinfo failed')

file:/etc/passwd
Traceback (most recent call last):
  File "urllib2.py", line 1154, in ?
    f = urlopen(url, req)
  File "urllib2.py", line 136, in urlopen
    return _opener.open(url, data)
  File "urllib2.py", line 333, in open
    '_open', req)
  File "urllib2.py", line 313, in _call_chain
    result = func(*args)
  File "urllib2.py", line 928, in file_open
    return self.open_local_file(req)
  File "urllib2.py", line 943, in open_local_file
    stats = os.stat(localfile)
OSError: [Errno 2] No such file or directory:
'\etc\passwd'
>Exit code: 1


----------------------------------------------------------------------

Comment By: George Yoshida (quiver)
Date: 2003-11-19 00:48

Message:
Logged In: YES 
user_id=671362

For the first one, you need to specify a host to run the 
test.

For expample,
  >python ftplib.py ftp.python.org -l
This gives
  drwxrwxr-x   5 webmaster webmaster      512 Jan 25  
2003 pub

There is a usage on the test in the script:
'''Test program.
Usage: ftp [-d] [-r[file]] host [-l[dir]] [-d[dir]] [-p] 
[file] ...'''

I think this is not a bug.


For the second one, catching OSError along with IOError 
might be needed.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=844336&group_id=5470



More information about the Python-bugs-list mailing list