IOError - cannot create file (linux daemon-invoked script)

Cameron Simpson cs at
Sun Jan 3 05:02:38 CET 2010

On 02Jan2010 15:21, cassiope <fpm at> wrote:
| [...]  I want
| to save a copy of the email in a particular directory which is
| accessible to the Windows clients via samba.
| The strange thing is that even with the right user-id, I cannot seem
| to write to the directory, getting an IOError exception.  Changing the
| directory to world-writable fixes this.  I can confirm the uid and gid
| for the script by having the script print these values just before
| trying to create/write the file.  Becoming the same lesser user, I
| have no problem writing a file to the same directory.

Can you show us:
  - the directory user and group ownership and permissions
  - the daemon's user and group values?

You can also strace your daemon:

  strace -f -e trace=file your-daemon your-daemon-args... 2>strace.out

and then examine the log for the precise UNIX-level failure.

Cameron Simpson <cs at> DoD#743

Money won't buy happiness, but it will pay the salary of a large research
staff to study the problem. - Bill Vaughan

More information about the Python-list mailing list