osreplace
Backport of os.replace()
http://docs.python.org/3.3/library/os.html#os.replace
http://bugs.python.org/issue8828
Suggested usage:
import sys
if sys.version_info >= (3, 3):
from os import replace
elif sys.platform == "win32":
from osreplace import replace
else:
# POSIX rename() is always atomic
from os import rename as replace
Python 3.1 is not supported. Please upgrade to Python 3.2 or better.
Technical details
The replace() function uses MoveFileEx() with MOVEFILE_REPLACE_EXISTING flag. The flag can’t be used to rename directories so it’s not entirely equal to rename(P) on POSIX.
MoveFileEx() is NOT guaranteed to be atomic. Under certain and unknown circumstances it may silently fall back to a non atomic call to CopyFile(). MoveFileTransacted() could improve the situation but it requires Vista or newer.
http://msdn.microsoft.com/en-us/library/windows/desktop/aa365240%28v=vs.85%29.aspx http://msdn.microsoft.com/en-us/library/windows/desktop/aa365241%28v=vs.85%29.aspx
Credits
Original patch by Antoine Pitrou.
Changelog
pyosreplace 0.1
Release date: 05-Nov-2013
Python 3.2 support
tox for testing
pyosreplace 0.1b1
Release date: 02-Jul-2013
initial beta release
Release files for pyosreplace 0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pyosreplace-0.1.zip | 10.5 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| pyosreplace-0.1.win-amd64-py3.2.exe | Details | |||
| pyosreplace-0.1.win-amd64-py2.7.exe | Details | |||
| pyosreplace-0.1.win-amd64-py2.6.exe | Details | |||
| pyosreplace-0.1.win32-py3.2.exe | Details | |||
| pyosreplace-0.1.win32-py2.7.exe | Details | |||
| pyosreplace-0.1.win32-py2.6.exe | Details |
Total release size: 1.3 MB
Release files / pyosreplace-0.1.zip
| Download URL | pyosreplace-0.1.zip |
|---|---|
| Size | 10.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3b4a587525cf2d98deae834a5263163250b370d463da4d78721dda13f254ad41
|
|
BLAKE2b-256 checksum How to use checksums |
1e73ce3f6bcc91ae170569d3ab00bfd2a725607497ad2eb434f3ac27684635be
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / pyosreplace-0.1.win-amd64-py3.2.exe
| Download URL | pyosreplace-0.1.win-amd64-py3.2.exe |
|---|---|
| Size | 229.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d5738dea1b7e1bde70680fd330aaf31052122971c1068f315f7001db45a78da8
|
|
BLAKE2b-256 checksum How to use checksums |
4a8eb0ca76d872082f5967f16d637021402289df5367af1de4afda04b83c2637
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / pyosreplace-0.1.win-amd64-py2.7.exe
| Download URL | pyosreplace-0.1.win-amd64-py2.7.exe |
|---|---|
| Size | 229.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
33f9742e7a3a664ec0048d8744458770e579326ee70b3d7c2106018f2764a2d0
|
|
BLAKE2b-256 checksum How to use checksums |
2f3df49c166270703b82d3c2f62ce087fc87a8c724252c7c4af908ca48c2148f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / pyosreplace-0.1.win-amd64-py2.6.exe
| Download URL | pyosreplace-0.1.win-amd64-py2.6.exe |
|---|---|
| Size | 229.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1cba5df4a39a439e054914b7ec0f2acbad3c90a50969c69fce9c3b95be2e1c47
|
|
BLAKE2b-256 checksum How to use checksums |
83d94123256c8d9769ff73af98931834cb64d8c2b57605ca7f2b0256d8ad7c7b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / pyosreplace-0.1.win32-py3.2.exe
| Download URL | pyosreplace-0.1.win32-py3.2.exe |
|---|---|
| Size | 201.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4a57c9dd6ac38dcdbc6181f5f22476f78e0aef3dc9d2e450324122c5523b485a
|
|
BLAKE2b-256 checksum How to use checksums |
5631b0284098c829246f9740493f540628fb3c077358206dc92943589b4179d4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / pyosreplace-0.1.win32-py2.7.exe
| Download URL | pyosreplace-0.1.win32-py2.7.exe |
|---|---|
| Size | 201.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
bd7917434328f6ea5449e7dc28d835ca85515b2a3aa1128694fcd75be9f6a410
|
|
BLAKE2b-256 checksum How to use checksums |
07ea4f3ded4b1775aaae1426e34c22889b3b59c7863202baa1140fff299e7ec3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / pyosreplace-0.1.win32-py2.6.exe
| Download URL | pyosreplace-0.1.win32-py2.6.exe |
|---|---|
| Size | 202.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e00fb2f7f25b6092913c735538c202a31016b89640457decca3ae779d88dad9f
|
|
BLAKE2b-256 checksum How to use checksums |
f39c058dd280ed3354dd21475cde26b375d6da042590e10968ce796c88827355
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |