Show More
@@ -28,10 +28,10 b' unlink = win32.unlink' | |||||
28 | umask = 0022 |
|
28 | umask = 0022 | |
29 | _SEEK_END = 2 # os.SEEK_END was introduced in Python 2.5 |
|
29 | _SEEK_END = 2 # os.SEEK_END was introduced in Python 2.5 | |
30 |
|
30 | |||
31 | # wrap osutil.posixfile to provide friendlier exceptions |
|
|||
32 | def posixfile(name, mode='r', buffering=-1): |
|
31 | def posixfile(name, mode='r', buffering=-1): | |
|
32 | '''Open a file with even more POSIX-like semantics''' | |||
33 | try: |
|
33 | try: | |
34 | fp = osutil.posixfile(name, mode, buffering) |
|
34 | fp = osutil.posixfile(name, mode, buffering) # may raise WindowsError | |
35 |
|
35 | |||
36 | # The position when opening in append mode is implementation defined, so |
|
36 | # The position when opening in append mode is implementation defined, so | |
37 | # make it consistent with other platforms, which position at EOF. |
|
37 | # make it consistent with other platforms, which position at EOF. | |
@@ -40,8 +40,8 b" def posixfile(name, mode='r', buffering=" | |||||
40 |
|
40 | |||
41 | return fp |
|
41 | return fp | |
42 | except WindowsError, err: |
|
42 | except WindowsError, err: | |
|
43 | # convert to a friendlier exception | |||
43 | raise IOError(err.errno, '%s: %s' % (name, err.strerror)) |
|
44 | raise IOError(err.errno, '%s: %s' % (name, err.strerror)) | |
44 | posixfile.__doc__ = osutil.posixfile.__doc__ |
|
|||
45 |
|
45 | |||
46 | class winstdout(object): |
|
46 | class winstdout(object): | |
47 | '''stdout on windows misbehaves if sent through a pipe''' |
|
47 | '''stdout on windows misbehaves if sent through a pipe''' |
General Comments 0
You need to be logged in to leave comments.
Login now