Greg Wilson on Nostr: Using Python 3.11 or higher, I want to create an output file *and* add a line ...
Using Python 3.11 or higher, I want to create an output file *and* add a line describing it to a log file as an atomic operation: either the output file is created and the log entry is added, or neither happens. fcntl.flock() is only advisory - will something else give me stronger guarantees, preferably on all three major OSes? #python #file-lock #atomic-operation #question
Published at
2024-05-25 19:45:13Event JSON
{
"id": "6b0c9cbb923845f949b20347aacac576c889ec2f8aff3b494325baf5a09f5867",
"pubkey": "471ec8585d6c2fd5f911c7a8444add9942c4b8e37365db2a1cb87c5e13c0df8f",
"created_at": 1716666313,
"kind": 1,
"tags": [
[
"t",
"python"
],
[
"t",
"file"
],
[
"t",
"atomic"
],
[
"t",
"question"
],
[
"proxy",
"https://mastodon.social/users/gvwilson/statuses/112503443489939000",
"activitypub"
]
],
"content": "Using Python 3.11 or higher, I want to create an output file *and* add a line describing it to a log file as an atomic operation: either the output file is created and the log entry is added, or neither happens. fcntl.flock() is only advisory - will something else give me stronger guarantees, preferably on all three major OSes? #python #file-lock #atomic-operation #question",
"sig": "0164ce2b5a1a2154f98e99e8e511ee43fac6ce15c165225a4636696e9ea24ca222eae87f5d6dea6e71e7a6eef3002674b388061af124e74545ecb2206515195b"
}