Show More
@@ -26,11 +26,19 b' testpid = win32.testpid' | |||
|
26 | 26 | unlink = win32.unlink |
|
27 | 27 | |
|
28 | 28 | umask = 0022 |
|
29 | _SEEK_END = 2 # os.SEEK_END was introduced in Python 2.5 | |
|
29 | 30 | |
|
30 | 31 | # wrap osutil.posixfile to provide friendlier exceptions |
|
31 | 32 | def posixfile(name, mode='r', buffering=-1): |
|
32 | 33 | try: |
|
33 |
|
|
|
34 | fp = osutil.posixfile(name, mode, buffering) | |
|
35 | ||
|
36 | # The position when opening in append mode is implementation defined, so | |
|
37 | # make it consistent with other platforms, which position at EOF. | |
|
38 | if 'a' in mode: | |
|
39 | fp.seek(0, _SEEK_END) | |
|
40 | ||
|
41 | return fp | |
|
34 | 42 | except WindowsError, err: |
|
35 | 43 | raise IOError(err.errno, '%s: %s' % (name, err.strerror)) |
|
36 | 44 | posixfile.__doc__ = osutil.posixfile.__doc__ |
General Comments 0
You need to be logged in to leave comments.
Login now