Masaru Tsuchiyama wrote on Sun, Aug 18, 2013 at 22:58:09 +0900:
>> To further explain this consideration: even if both existence and
>> permissions were checked, the code would *still* be wrong if args[0]
>> were a directory.  If an .isdir() check were added, the code would
>> still be wrong if args[0] were a dangling symlink.  And so on.
>>
>> Calling open() will detect all those potential problems.
>
> Thank you for the commit.
>
> But I think you should catch a exception which parser.readfp() throws,
> and print approprite error mesage.
>

.readfp() doesn't throw an exception.  It's __builtins__.open() that does.

> I think Users who don't know Python prefer an well-formatted
> error message to stack trace.

I don't have a preference among those.

Cheers,

Daniel

Reply via email to