Hello. Am a Python newbie. I have researched and found examples how we can check existence, readability, and write-ability on a given fully-qualified filename for the current python script user. Evidently os.access is the way to go, wrapped in some additional try and catch logic that helps insulate us from changes in file state after our os.access checks.
I understand that os.stat() calls can be relatively expensive. I assume likewise for os.access(). Since I'm going to apply my Python permission check script within a NiFi ExecuteScript processor handling many flowfiles, I seek any and all performance optimizations I possibly can. Is there a way to mask the F_OK, R_OK, and W_OK in a single os.access call? I'm guessing there must be, rather than doing this if ( os.access(fqfname,os.F_OK) and os.access(fqfname,os.R_OK) and os.access(fqfname,os.W_OK)) : Thanks in advance for your insights. -Jim -- https://mail.python.org/mailman/listinfo/python-list