[IronPython] os.strerror

Dino Viehland dinov at microsoft.com
Wed Jun 17 17:55:42 CEST 2009


Or there's always:

import nt
import errno
for x in dir(errno):
    val = getattr(errno, x)
    if type(val) is int:
            print ('case PythonErrorNumber.%s: return "' + nt.strerror(val) + '";') % x

:)

-----Original Message-----
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Seo Sanghyeon
Sent: Wednesday, June 17, 2009 1:56 AM
To: Discussion of IronPython
Subject: [IronPython] os.strerror

os.strerror is not implemented. Something as simple as the following woud work:

import os
import errno

def strerror(code):
    if code == errno.ENOENT:
        return 'No such file or directory'
    elif code == errno.EACCES:
        return 'Permission denied'
    else:
        return 'Unknown error ' + str(code)
os.strerror = strerror

--
Seo Sanghyeon
_______________________________________________
Users mailing list
Users at lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com



More information about the Ironpython-users mailing list