Having problems with urlparser concatenation

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Fri Nov 10 00:36:33 CET 2006


In <1163114626.595813.286260 at b28g2000cwb.googlegroups.com>, i80and wrote:

>     return self.open_local_file(url)
>   File "C:\Program Files\Python25\lib\urllib.py", line 465, in
> open_local_file
>     raise IOError(e.errno, e.strerror, e.filename)
> IOError: [Errno 2] The system cannot find the path specified:
> 'en.wikipedia.org\\robots.txt'
> 
> Note the last line 'en.wikipedia.org\\robots.txt'.  I want
> 'en.wikipedia.org/robots.txt'!  What am I doing wrong?

You don't have that file on you local computer.  :-)

If you look at the messages above you'll see there's a function
`open_local_file()` involved.  This function is chosen by `urllib` because
your path looks like a local file, i.e. it lacks the protocol information.
You don't want 'en.wikipedia.org/robots.txt', you want
'http://en.wikipedia.org/robots.txt'!

Ciao,
	Marc 'BlackJack' Rintsch



More information about the Python-list mailing list