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.

Author vstinner
Recipients brett.cannon, ncoghlan, pitrou, vstinner
Date 2011-10-16.21:36:22
SpamBayes Score 4.9960036e-15
Marked as misclassified No
Message-id <1318800983.89.0.916571298776.issue13192@psf.upfronthosting.co.za>
In-reply-to
Content
> I suggest also ignoring ENOTDIR and EISDIR. Not sure about EACCES.

We should maybe mimick the io module:


>>> open('Lib')
IsADirectoryError: [Errno 21] Is a directory: 'Lib'

In the io module, opening a directory raises an exception. In the import machinery, an explicit check is done (stat+ISDIR) before opening the file. The file is ignored if it is a directory. We can maybe remove the test before opening the file, and handle IsADirectoryError exception instead.

--

I don't think that fopen() can fails with ENOTDIR. rmdir() can fail with ENOTDIR.

--

For EACCES: Python ignores currently these errors. I was already surprised by this behaviour. My use case: I have two users (haypo and fusil). I "installed" a module of haypo user into /usr/lib/python... using symlink, but fusil doesn't have access to /home/haypo. When fusil tries to load a module, import fails without any warning or error.

Fail with an error is maybe not a good idea because it's not because a directory of sys.path cannot be read, than the import will fail. The module can be found in another (accessible) directory.
History
Date User Action Args
2011-10-16 21:36:23vstinnersetrecipients: + vstinner, brett.cannon, ncoghlan, pitrou
2011-10-16 21:36:23vstinnersetmessageid: <1318800983.89.0.916571298776.issue13192@psf.upfronthosting.co.za>
2011-10-16 21:36:23vstinnerlinkissue13192 messages
2011-10-16 21:36:23vstinnercreate