I'm trying to get my code to change the group executability permission using os.chmod while keeping all the other permissions in their original state, but I can't seem to figure out how.
All the chmod numbers change all the permissions. I want my program to change the group executability permission to True if it's currently False, and to False if it's currently True
In order to "flip" the group execute bit you could do this:
import os
os.chmod(filename, os.stat(filename).st_mode ^ 0o10)