Show More
@@ -59,6 +59,7 b" if os.name != 'nt':" | |||
|
59 | 59 | posixfile = open |
|
60 | 60 | else: |
|
61 | 61 | import ctypes, msvcrt |
|
62 | from errno import ESRCH, ENOENT | |
|
62 | 63 | |
|
63 | 64 | _kernel32 = ctypes.windll.kernel32 |
|
64 | 65 | |
@@ -98,7 +99,14 b' else:' | |||
|
98 | 99 | |
|
99 | 100 | def _raiseioerror(name): |
|
100 | 101 | err = ctypes.WinError() |
|
101 | raise IOError(err.errno, '%s: %s' % (name, err.strerror)) | |
|
102 | # For python 2.4, treat ESRCH as ENOENT like WindowsError does | |
|
103 | # in python 2.5 or later. | |
|
104 | # py24: WindowsError(3, '').errno => 3 | |
|
105 | # py25 or later: WindowsError(3, '').errno => 2 | |
|
106 | errno = err.errno | |
|
107 | if errno == ESRCH: | |
|
108 | errno = ENOENT | |
|
109 | raise IOError(errno, '%s: %s' % (name, err.strerror)) | |
|
102 | 110 | |
|
103 | 111 | class posixfile(object): |
|
104 | 112 | '''a file object aiming for POSIX-like semantics |
General Comments 0
You need to be logged in to leave comments.
Login now