Message145645
> 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. |
|
Date |
User |
Action |
Args |
2011-10-16 21:36:23 | vstinner | set | recipients:
+ vstinner, brett.cannon, ncoghlan, pitrou |
2011-10-16 21:36:23 | vstinner | set | messageid: <1318800983.89.0.916571298776.issue13192@psf.upfronthosting.co.za> |
2011-10-16 21:36:23 | vstinner | link | issue13192 messages |
2011-10-16 21:36:23 | vstinner | create | |
|