all scripts - check if log files are read-only
Some logs can be read only and the scripts will crash if python can't write to them.
Perhaps ififuncs could get a function that performs various checks such as this that might be required for all scripts.
I have a function that takes a path and does a recursive chmod through it... that could be adapted to check the required permission before doing a permission change. You could also make it chown to whatever user the python script is running under.
This sounds exactly like what I need. Is it using a subprocess to call chown,or is it using some permissions function within os? The reason I ask is that chown won't work on windows.
It's an os function, but I don't know how fully it's supported on Windows given your needs?
Note: Although Windows supports chmod(), you can only set the file’s read-only flag with it (via the stat.S_IWRITE and stat.S_IREAD constants or a corresponding integer value). All other bits are ignored.
Here's my bit.