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
In python3:
import os os.chmod("somefile", 0o664)
Remember to add the 0o prefix since permissions are set as an octal integer, and Python automatically treats any integer with a leading zero as octal. Otherwise, you are passing os.chmod("somefile", 1230) indeed, which is octal of 664.
0o
os.chmod("somefile", 1230)
664