[Python-bugs-list] [ python-Bugs-463286 ] Problem in urllib. No strip attribute
noreply@sourceforge.net
noreply@sourceforge.net
Thu, 20 Sep 2001 11:42:08 -0700
Bugs item #463286, was opened at 2001-09-20 11:02
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=463286&group_id=5470
Category: Python Library
>Group: Not a Bug
>Status: Closed
>Resolution: Invalid
Priority: 5
Submitted By: Francesc Alted (falted)
>Assigned to: Guido van Rossum (gvanrossum)
Summary: Problem in urllib. No strip attribute
Initial Comment:
If one make use of the urllib.urlopen method to open
an object which is not an URL (for exemple a
filehandler), in place of throwing a IOError
exception, the next error appears:
File "/usr/local/lib/python2.1/urllib.py", line
904, in unwrap
url = url.strip()
AttributeError: strip
I'm using Python 2.1.1. It seems like Guido wanted to
strip out the use of string methods in urllib, but
the unwrap method was not tested enough.
I'm attaching a small source file which expose the
flaw easily.
Cheers,
Francesc Alted
----------------------------------------------------------------------
>Comment By: Guido van Rossum (gvanrossum)
Date: 2001-09-20 11:42
Message:
Logged In: YES
user_id=6380
> file = urllib.urlopen(file_handler)
This line is broken. urlopen() takes a string argument, but
file_handler (poorly chosen name) is an open file object,
not a string.
Rejecting this as a pilot error.
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=463286&group_id=5470