Error happens while applying "chmod" to tmp file

  • OS: Centos7
  • Language: Python
  • Related Code: os.system('chmod g+w %s' % path)
  • Description:

    1. I want to run this command after creating a file
    2. But when I edit and save the existing file, the OS will create the .tmp file like ~gvfSFkS.tmp and then move,this is rename,the tmp file to override the file that was edited.
    3. Here is the INFO the shell giving
      `chmod: cannot access ‘/home/share/private/student/aa/~gvfSFkS.tmp’: No such file or directory
  • What I want to know

    1. The season why it happens?
    2. How I can apply chmod commad to such kind files.
  • Others
    I want this python script as root.
阅读 425