Reputation: 544
Hi Stackoverflow experts, this is a hard one, for Python programmers.
I'm working on an encrypted SQLITE3 container, written in Python. The final target are users, not developers.
All the functions are working as expected, but my problem is with a function to EXECUTE files from the container.
How the EXECUTE works:
Ok, so steps 1 and 2 are ok. I would prefer NOT to write the file on HDD, for example i want to execute it from memory, but you need to tell each app WHERE to open a file from, it must be a path from HDD, right?
The most secure would be to implement my own internal viewers for text, images, music, video, so i don't need to export the data on HDD. But this is not realistic :)
So the problem are steps 4 and 5. How do i know WHEN to delete the file after execution, if the execution is not blocking ?...
I tried all the functions from subprocess (wait, communicate, check_call) and os.system, to make the execution blocking... Maybe there are other functions to wait for processes to finish ?...
Maybe there is a way to delete the temporary files automatically ? Or i should make a list on runtime and delete them when the program closes...
Maybe there is a way to check if a file is opened by some app ? Ex: "my-pic.jpg" is opened by Image-Viewer, so i cannot delete it yet, but i will check again in a few seconds and if no other app uses it, i can delete it. // Maybe with "ps ax | grep my-pic" i can find if the file is open. But this doesn't work on Windows.
Any ideas, any sugestions ?
Thank you very much !
Upvotes: 1
Views: 838
Reputation: 3615
Some ideas:
Upvotes: 1