cpython icon indicating copy to clipboard operation
cpython copied to clipboard

webchecker dies on file: URLs w/o robots

Open freddrake opened this issue 25 years ago • 6 comments

BPO 482171
Nosy @gvanrossum, @freddrake

Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

Show more details

GitHub fields:

assignee = 'https://github.com/gvanrossum'
closed_at = <Date 2002-04-10.19:06:43.000>
created_at = <Date 2001-11-15.17:06:22.000>
labels = []
title = 'webchecker dies on file: URLs w/o robots'
updated_at = <Date 2002-04-10.19:06:43.000>
user = 'https://github.com/freddrake'

bugs.python.org fields:

activity = <Date 2002-04-10.19:06:43.000>
actor = 'gvanrossum'
assignee = 'gvanrossum'
closed = True
closed_date = None
closer = None
components = ['Demos and Tools']
creation = <Date 2001-11-15.17:06:22.000>
creator = 'fdrake'
dependencies = []
files = []
hgrepos = []
issue_num = 482171
keywords = []
message_count = 6.0
messages = ['7568', '7569', '7570', '7571', '7572', '7573']
nosy_count = 3.0
nosy_names = ['gvanrossum', 'fdrake', 'nectar']
pr_nums = []
priority = 'normal'
resolution = 'fixed'
stage = None
status = 'closed'
superseder = None
type = None
url = 'https://bugs.python.org/issue482171'
versions = []

freddrake avatar Nov 15 '01 17:11 freddrake

When webchecker is run on local documents using a file: URL, it dies if there is not a robots.txt in the root directory:

cj42289-a(.../python/Doc); python
../Tools/webchecker/webchecker.py file:`pwd`/html/api/
webchecker version 1.24
Traceback (most recent call last):
  File "../Tools/webchecker/webchecker.py", line 858, in ?
    main()
  File "../Tools/webchecker/webchecker.py", line 205,
in main
    c.addroot(arg)
  File "../Tools/webchecker/webchecker.py", line 324,
in addroot
    self.addrobot(root)
  File "../Tools/webchecker/webchecker.py", line 337,
in addrobot
    rp.read()
  File "/usr/local/lib/python2.2/robotparser.py", line
43, in read
    f = opener.open(self.url)
  File "/usr/local/lib/python2.2/urllib.py", line 178,
in open
    return getattr(self, name)(url)
  File "/usr/local/lib/python2.2/urllib.py", line 405,
in open_file
    return self.open_local_file(url)
  File "/usr/local/lib/python2.2/urllib.py", line 412,
in open_local_file
    stats = os.stat(localname)
OSError: [Errno 2] No such file or directory: '/robots.txt'

freddrake avatar Nov 15 '01 17:11 freddrake

Logged In: YES user_id=6380

Fixed in webchecker.py rev. 1.25.

gvanrossum avatar Dec 11 '01 22:12 gvanrossum

Logged In: YES user_id=14672

Please see bug ID 541980. I believe the fix here (webchecker.py rev 1.25) was incorrect.

nectar avatar Apr 10 '02 14:04 nectar

Logged In: YES user_id=6380

Maybe I'm dense, but I don't see the connection.

Can you elaborate? I've reopened the bug report for your convenience.

gvanrossum avatar Apr 10 '02 15:04 gvanrossum

Logged In: YES user_id=14672

I should have been more clear.

The code in question in webchecker.py expected (correctly) to handle IOError exceptions from urlopen. However, due to bug 541980, urlopen (incorrectly) can raise an OSError exception when handling 'file:' URLs.

The fix made in rev 1.25 of webchecker.py was to catch both the IOError and OSError exceptions. This fix is incorrect, because urlopen should not be raising OSError for this type of condition (file not found).

nectar avatar Apr 10 '02 16:04 nectar

Logged In: YES user_id=6380

I wouldn't call the fix incorrect. It's harmless. If 541980 was fixed it wouldn't be necessary, but who cares.

gvanrossum avatar Apr 10 '02 19:04 gvanrossum