Use os.stat()
to get the current permissions, use |
to OR the bits together, and use os.chmod()
to set the updated permissions.
Example:
import os
import stat
st = os.stat('somefile')
os.chmod('somefile', st.st_mode | stat.S_IEXEC)
Use os.stat()
to get the current permissions, use |
to OR the bits together, and use os.chmod()
to set the updated permissions.
Example:
import os
import stat
st = os.stat('somefile')
os.chmod('somefile', st.st_mode | stat.S_IEXEC)