Create a file that attaches to the lifetime of the process in python
up vote
0
down vote
favorite
I'm looking for away to create a file that is attached for the life time of the process, and that another process can access it.
Assume process A that creates a file, assume process B that can access this file (so it needs to know its location) , now when process A is being shutdown (no matter the cause) the file is being deleted.
As far as I can tell tmpfile is not good enough as process B would not be able to locate the file (in trivial way)
Any other ideas?
Thanks,
python python-3.x
add a comment |
up vote
0
down vote
favorite
I'm looking for away to create a file that is attached for the life time of the process, and that another process can access it.
Assume process A that creates a file, assume process B that can access this file (so it needs to know its location) , now when process A is being shutdown (no matter the cause) the file is being deleted.
As far as I can tell tmpfile is not good enough as process B would not be able to locate the file (in trivial way)
Any other ideas?
Thanks,
python python-3.x
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I'm looking for away to create a file that is attached for the life time of the process, and that another process can access it.
Assume process A that creates a file, assume process B that can access this file (so it needs to know its location) , now when process A is being shutdown (no matter the cause) the file is being deleted.
As far as I can tell tmpfile is not good enough as process B would not be able to locate the file (in trivial way)
Any other ideas?
Thanks,
python python-3.x
I'm looking for away to create a file that is attached for the life time of the process, and that another process can access it.
Assume process A that creates a file, assume process B that can access this file (so it needs to know its location) , now when process A is being shutdown (no matter the cause) the file is being deleted.
As far as I can tell tmpfile is not good enough as process B would not be able to locate the file (in trivial way)
Any other ideas?
Thanks,
python python-3.x
python python-3.x
edited Nov 8 at 8:42
asked Nov 8 at 8:32
Eden
1,70411317
1,70411317
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
2
down vote
accepted
To attach the file lifetime with the process lifetime you can use signal handling (Cf. doc). You just need to call
signal(SIGTERM, your_deleting_file_method)
inside the A process. By doing this you are free to define a static filename if it meets your need.
New contributor
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
To attach the file lifetime with the process lifetime you can use signal handling (Cf. doc). You just need to call
signal(SIGTERM, your_deleting_file_method)
inside the A process. By doing this you are free to define a static filename if it meets your need.
New contributor
add a comment |
up vote
2
down vote
accepted
To attach the file lifetime with the process lifetime you can use signal handling (Cf. doc). You just need to call
signal(SIGTERM, your_deleting_file_method)
inside the A process. By doing this you are free to define a static filename if it meets your need.
New contributor
add a comment |
up vote
2
down vote
accepted
up vote
2
down vote
accepted
To attach the file lifetime with the process lifetime you can use signal handling (Cf. doc). You just need to call
signal(SIGTERM, your_deleting_file_method)
inside the A process. By doing this you are free to define a static filename if it meets your need.
New contributor
To attach the file lifetime with the process lifetime you can use signal handling (Cf. doc). You just need to call
signal(SIGTERM, your_deleting_file_method)
inside the A process. By doing this you are free to define a static filename if it meets your need.
New contributor
New contributor
answered Nov 8 at 9:05
T.Lucas
462
462
New contributor
New contributor
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53203985%2fcreate-a-file-that-attaches-to-the-lifetime-of-the-process-in-python%23new-answer', 'question_page');
}
);
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password