[Python-Dev] Symbolic errno values in error messages

Alexandre Vassalotti alexandre at peadrop.com
Fri May 16 18:58:15 CEST 2008


On Fri, May 16, 2008 at 10:52 AM, Yannick Gingras <ygingras at ygingras.net> wrote:
> "Alexander Belopolsky" <alexander.belopolsky at gmail.com> writes:
>
>>>>> try:
>> ...    open('/')
>> ... except Exception,e:
>> ...    pass
>> ...
>>>>> print e
>> [Errno 21] Is a directory
>>
>> So now I am not sure what OP is proposing.  Do you want to replace 21
>> with EISDIR in the above?
>
> Yes, that's what I had in mind.
>

Then, check out EnvironmentError_str in Objects/exceptions.c. You
should be able import the errno module and fetch its errorcode
dictionary.

-- Alexandre


More information about the Python-Dev mailing list