<br><br><div><span class="gmail_quote">On 5/6/07, <b class="gmail_sendername">"Martin v. Löwis"</b> <<a href="mailto:martin@v.loewis.de">martin@v.loewis.de</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
> Now, why don't we change the semantics as follows: if a file with matching name<br>> exists (in import.c::find_module), but opening fails, ImportError is raised<br>> immediately with the concrete error message, and without trying the rest of
<br>> sys.path. That shouldn't cause any working and sane setup to break, or did I<br>> overlook something obvious here?<br><br>I wonder how this would behave if a directory on sys.path was<br>unreadable. You might get an ImportError on *any* import, as
<br>it tries the unreadable directory first, gets a permission error,<br>and immediately aborts.<br><br>Now, I think it is quite possible that you have inaccessible<br>directories on sys.path, e.g. when you inherit PYTHONPATH from
<br>a parent process.<br><br>So I would rather let importing proceed, and add a note to the<br>error message that some files could not be read.</blockquote><div><br><br>How about an ImportWarning instead? That way people can have either have import halt immediately, or continue (with or without a message).
<br><br>-Brett<br></div><br></div><br>