External script question
I have an external script that runs fine when I invoke it from the shell as user "zope". However, when I try and run this script from the "Test" tab within the ZMI, it fails. Can anyone point me in the direction of a solution for this? Thanks, Kevin
On Mon, Jun 24, 2002 at 01:51:57PM -0400, Kevin Carlson wrote:
I have an external script that runs fine when I invoke it from the shell as user "zope". However, when I try and run this script from the "Test" tab within the ZMI, it fails. Can anyone point me in the direction of a solution for this?
could you show us the script so we could look at it and maybe be able to answer ? Jerome Alet
Jerome, 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 When I run this script fragment from the shell logged in as user "zope", the newlist command succeeds. However, when I run it from the Test tab as mentioned, it fails. If I comment out these few lines, the rest of the script runs as expected. Kevin -----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Jerome Alet Sent: Monday, June 24, 2002 2:14 PM To: Kevin Carlson Cc: zope@zope.org Subject: Re: [Zope] External script question On Mon, Jun 24, 2002 at 01:51:57PM -0400, Kevin Carlson wrote:
I have an external script that runs fine when I invoke it from the shell as user "zope". However, when I try and run this script from the "Test" tab within the ZMI, it fails. Can anyone point me in the direction of a solution for this?
could you show us the script so we could look at it and maybe be able to answer ? Jerome Alet _______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )
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
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
On Mon, Jun 24, 2002 at 03:39:55PM -0400, Kevin Carlson wrote:
.... File "/home/mailman/Mailman/Utils.py", line 265, in MakeDirTree os.mkdir(made_part, perms) OSError: [Errno 13] Permission denied: '/home/mailman/lists/test'
are you sure that test didn't already exist ?
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.
did you restart Zope after having added 'zope' to the mailman group ?
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?
no, sorry. Jerome Alet
participants (2)
-
Jerome Alet -
Kevin Carlson