I want to create a file from within a python script that is executable.
import os import stat os.chmod(\'somefile\', stat.S_IEXEC)
it appea
Use os.stat() to get the current permissions, use | to or the bits together, and use os.chmod() to set the updated permissions.
os.stat()
|
os.chmod()
Example:
import os import stat st = os.stat('somefile') os.chmod('somefile', st.st_mode | stat.S_IEXEC)