This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: pydoc error page due to lacking permissions on ./*
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.2, Python 3.3, Python 2.7
process
Status: closed Resolution: duplicate
Dependencies: Superseder: pkgutil.walk_packages fails on write-only directory in sys.path
View: 7367
Assigned To: ned.deily Nosy List: eric.araujo, ezio.melotti, gagern, georg.brandl, ned.deily, terry.reedy
Priority: normal Keywords:

Created on 2011-08-05 13:39 by gagern, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (5)
msg141658 - (view) Author: Martin von Gagern (gagern) Date: 2011-08-05 13:39
I'd like to be able to run "pydoc -b" in whatever directory I'm currently in. Most of the time that would be the root of my home directory, which is an ext4fs mount. So it has a subdirectory called "lost+found" for which I don't have any access permissions. As a result, the main pydoc info page will simply print an error message:

OSError: [Errno 13] Permission denied: './lost+found'

I'm not sure how best to address this. There are several possibilities that come to my mind:

 1. Provide a command line switch to strip '.' from sys.path.
 2. Skip any sys.path elements which cause exceptions, possibly
    printing a warning in addition to the remaining page content.
 3. Skip any single subdirectry which causes an exception,
    as this more closely models what importing by name would do.
 4. Explicitely skip lost+found, or perhaps any directory name which
    would be invalid as a module name.

Obviously, the workaround is to change to a sufficiently empty directory before starting pydoc. So this is a minor issue, but annoying nevertheless.
msg141684 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2011-08-05 20:26
Do any of you three have anything to do with pydoc?

Given that the manual simply says "pydoc -b will start the server and additionally open a web browser to a module index page." without qualifications, quitting when started from certain locations strikes me as a bug.  I do not see a reason to not just continue.
msg141692 - (view) Author: Martin von Gagern (gagern) Date: 2011-08-05 21:44
The server continues all right. It's the browser window which displays the error message. Not much better in my opinion, though.

To be completely accurate: currently the -b option doens't work as it should due to issue #11432. But using "-p 0" and opening the link manually is a suitable workaround for now.
msg141703 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2011-08-06 02:59
This is essentially a duplicate of Issue11914.  The root cause is that pkgutil.iter_modules doesn't deal with permission errors when traversing paths.  Issue7367 is also related.
msg145057 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2011-10-07 06:23
This problem has been fixed with the changes for Issue7367 and, for 2.7, Issue7425.  They should appear in 3.3.0, 3.2.3, and 2.7.3.
History
Date User Action Args
2022-04-11 14:57:20adminsetgithub: 56905
2011-10-07 06:23:23ned.deilysetstatus: open -> closed
resolution: duplicate
messages: + msg145057

superseder: pkgutil.walk_packages fails on write-only directory in sys.path
stage: test needed -> resolved
2011-08-06 02:59:18ned.deilysetassignee: ned.deily

messages: + msg141703
nosy: + ned.deily
2011-08-05 21:44:02gagernsetmessages: + msg141692
2011-08-05 20:26:20terry.reedysetversions: + Python 2.7, Python 3.3
nosy: + terry.reedy, georg.brandl, ezio.melotti, eric.araujo

messages: + msg141684

type: enhancement -> behavior
stage: test needed
2011-08-05 13:39:40gagerncreate