[Python-Dev] ImportError on no permission

Terry Reedy tjreedy at udel.edu
Sun May 6 21:48:09 CEST 2007

""Martin v. Löwis"" <martin at v.loewis.de> wrote in message 
news:463E20F1.5000102 at v.loewis.de...
|> Now, why don't we change the semantics as follows: if a file with 
matching name
| > exists (in import.c::find_module), but opening fails, ImportError is 
| > immediately with the concrete error message, and without trying the 
rest of
| > sys.path. That shouldn't cause any working and sane setup to break, or 
did I
| > overlook something obvious here?
| I wonder how this would behave if a directory on sys.path was
| unreadable.

I understood Brett to be talking about a different case where the directory 
*is* readable and the target file shows up in the directory list.  In this 
limited case, stopping seems sane to me.

| You might get an ImportError on *any* import, as
| it tries the unreadable directory first, gets a permission error,
| and immediately aborts.

Not if the patch is properly and narrowly written to only apply to 
unreadable files in readable directories.


More information about the Python-Dev mailing list