IFIscripts icon indicating copy to clipboard operation
IFIscripts copied to clipboard

all scripts - check if log files are read-only

Open kieranjol opened this issue 7 years ago • 4 comments

Some logs can be read only and the scripts will crash if python can't write to them.

kieranjol avatar Jul 05 '18 10:07 kieranjol

Perhaps ififuncs could get a function that performs various checks such as this that might be required for all scripts.

kieranjol avatar Jul 12 '18 17:07 kieranjol

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.

mcampos-quinn avatar Jul 12 '18 17:07 mcampos-quinn

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.

kieranjol avatar Jul 12 '18 17:07 kieranjol

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.

mcampos-quinn avatar Jul 12 '18 18:07 mcampos-quinn