[Zope] Executing an external program

Eric L. Walstad Eric@Walstads.net
Mon, 22 May 2000 13:39:04 -0700


Hi Brad,

I'm working on this now, too.  Here's what I've got so far:

--Start Python Module--

import sys, os, string

def rn():
    """
    docstring
    """
    f = os.popen("/usr/local/Zope/Extensions/a.out")
    lines = f.readlines()
    status = f.close()
    if status:
        "There was an error"
    return string.join( lines )

--End Python Module--

--Start C Code--
#include <iostream.h>

int main(){
	cout << "13.93";
	return 0;
}
--End C Code--

Note that it works from the Python command line, but not from a Zope
external method.  I'm still trying to figure out why it is failing from
within Zope (anybody have an idea?).  It might help you as a starting point,
however.  a.out is a simple C program that just sends a string to the
standard output (cout << "13.93";).

If you get something that works, please let me know.  I'll do the same.

Eric.

// -----Original Message-----
// From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Mabe,
// Brad
// Sent: Monday, May 22, 2000 12:45 PM
// To: 'zope@zope.org'
// Subject: [Zope] Executing an external program
//
//
// Is there a way for zope to call an external program (exe, batch
// file, etc.)
// and have it execute on the server?  I have several home grown
// utilities on
// my server that I would like to access/execute via the browser.
//
//     -=Brad=-
//
//
// _______________________________________________
// 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 )
//