3 ms·
> Either I have to grant the whole Python process sudo privileges and manually change the ownership of all touched files, or I have to spawn a sudo rm process t
by dragonwriter 2y ago
> Either I have to grant the whole Python process sudo privileges and manually change the ownership of all touched files, or I have to spawn a sudo rm process to remove the files owned by root (instead of using Python's standard library).
You could have a separate python script you call via sudo.
Or you could automate the equivalent within python. Old discussion:
https://www.reddit.com/r/Python/s/tIYUq1Zgd3 https://www.reddit.com/r/Python/s/tIYUq1Zgd3
Code (plus Python 3 & functionality updates; linked from the discussion, but knowing HN, some people will just wabt to skip straight to it):
https://gist.github.com/barneygale/8ff070659178135b10b5e202a1ecaa3f https://gist.github.com/barneygale/8ff070659178135b10b5e202a...