Hi Lee, This is eminently possible. Use an External Method (see http://www.zope.org/Members/michel/ZB/ScriptingZope.dtml , "Using External Methods"). Uisng an external method allows you to make use of Python without any security restrictions (unlike a Python Script). Then use one of Python's ways to start a process and obtain the output of the process. "os.popen" is one of these ways, e.g.: import os def externalMethod(self): args = "foo bar" p = os.popen('/do/something %s ' % args) return p.readlines() Note that this mechanism for interfacing with external processes is both prone to security and performance problems, but done carefully and prudently it's not a big issue. For other ways to interface python with external processes, pick up "Learning Python" (O'Reilly). Lee Philip Reilly wrote:
Hi,
I wonder if anyone could perhaps answer a question for me regarding Zope and it's ability to inter(face/act) with external applications - running on the same (linux) machine. I am developing a web application and one of it's functions requires it to be able to execute programs (mainly written in c, but also Fortran) via command lines including all the required arguments;
e.g. ./do-something -i1 file1.txt - i2 file2.txt -o results.txt
In some cases the program output would have to be obtained (and returned to Zope for processing), and in others it would not - some of the calculations take a few hours - in which case the results would be mailed directly to the user when complete. I anticipate the flow of things will be as follows:
1-User will submit some data / upload files via web forms. 2-Zope will then use this data and then generate a command to execute an external program running on the same machine. 3-The user can then be notified if the program executed correctly, and if applicable, return any data.
Can Zope be of any use here? Is the above possible? Is anyone doing something similar at the present time? If anyone could provide me with any information, I would greatly appreciate it.
- Best regards,
Lee Reilly
_______________________________________________ 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 Zope Corporation http://www.zope.org http://www.zope.com "Killing hundreds of birds with thousands of stones"