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=-
Brad, look into external methods. There is a howto on the zope.org website at http://www.zope.org/Documentation/How-To/ExternalMethods You'll need to know some Python, probably most importantly read about the os module's "popen" method at http://www.python.org/doc/current/lib/os-newstreams.html "Mabe, Brad" wrote:
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 )
-- Chris McDonough Digital Creations Publishers of Zope - http://www.zope.org
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 ) //
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?).
How does it 'not work' from an external method? --jfarr "Perl is worse than Python because people wanted it worse." Larry Wall, 14 Oct 1998
participants (4)
-
Chris McDonough -
Eric L. Walstad -
Jonothan Farr -
Mabe, Brad