[Zope] External script question

Kevin Carlson khcarlso@bellsouth.net
Mon, 24 Jun 2002 15:39:55 -0400


Jerome,

I sincerely appreciate your help with this.  I am in a bit of a permissions
quandary I think -- perhaps you can help me out.  Using your code below, the
following error was returned:

....
  File "/home/mailman/Mailman/Utils.py", line 265, in MakeDirTree
    os.mkdir(made_part, perms)
OSError: [Errno 13] Permission denied: '/home/mailman/lists/test'

The code was trying to create the directory 'test' in the
/home/mailman/lists/ directory.  The 'list' directory has the following
permissions and listing:

drwxrwsr-x    2 mailman mailman      4096  Jun 24 15:21 lists

I added user zope to the mailman group, but this still had no effect.  I
guess I'm having a difficult time understanding why I can run this when
logged in as "zope" from the shell, but not from the ZMI (where I have used
a script to verify the username is 'zope').

Any additional ideas?

Thanks,

Kevin

-----Original Message-----
From: Jerome Alet [mailto:alet@librelogiciel.com]
Sent: Monday, June 24, 2002 2:34 PM
To: Kevin Carlson
Cc: zope@zope.org
Subject: Re: [Zope] External script question


On Mon, Jun 24, 2002 at 02:18:36PM -0400, Kevin Carlson wrote:
>
> It is a rather long involved script, but here is the piece that is
failing.
> I am trying to integrate with mailman and create a new list by using the
> following script:
>
>    nlcommand = "/home/mailman/bin/newlist -q test test@test.org test"
>
>    if(os.system(nlCommand)) :
>       retval = "newlist command failed."
>       return retval

IMHO you should carefully check the os.system() call's return value.

you could replace the os.system() call with the following one
which I know for sure works :

def myexec(commandline) :
    import popen2
    process = popen2.Popen3(commandline, capturestderr=1)
    retcode = process.wait()
    output = process.fromchild.read()
    errors = process.childerr.read()

and check retcode according to the W* functions in
http://www.python.org/doc/current/lib/os-process.html#os-process

of course depending on the retcode you may or may not have
to read the child's stdout or stderr.

hth.

Jerome Alet