Executing Scripts in Zope
Hi all, I want to execute a Script from Zope. I created a file in the 'Extensions' directory containig following code: [code] #!/bin/sh echo DEFANGED.23 exit #!/usr/bin/python import os os.system( 'ls' ) [/code] If I want to execute this script, how do I do that? Thanks -mas
You can not start shell skripts from Zope. At least on directly. Create an ExternalMethod that starts your script using os.system() or os.popen(). Check with the Zope Book for details. -aj --On Freitag, 7. März 2003 11:37 +0100 Sorin Marti <mas@semafor.ch> wrote:
Hi all,
I want to execute a Script from Zope.
I created a file in the 'Extensions' directory containig following code:
[code]
# !/bin/sh echo DEFANGED.23 exit # !/usr/bin/python
import os
os.system( 'ls' )
[/code]
If I want to execute this script, how do I do that?
Thanks -mas
_______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
-- --------------------------------------------------------------------- - Andreas Jung http://www.andreas-jung.com - - EMail: andreas at andreas-jung.com - - "Life is too short to (re)write parsers" - ---------------------------------------------------------------------
Andreas Jung wrote:
You can not start shell skripts from Zope. At least on directly. Create an ExternalMethod that starts your script using os.system() or os.popen(). Check with the Zope Book for details.
-aj
First of all: Thanks to Andreas for answering my questions all the time! I read stuff in the python manual about os.system() and I read a tutorial about External methods on zope.org Now I've got following code: -------------------- def ltoh(self): """Compile TeX-File""" import os msg = os.system( 'latex2html /home/mas/test.tex' ) if msg == 0: return 'Successfull' else: return 'Not Successfull' -------------------- That works fine. Now I want to pass a parameter (the filename) and that doesn't work. How do I pass parameters? I tried a few things but nothing worked... A link to a good tutorial or manual would be great also. Thanks in Advance -mas
See the example in the Zope Book, 2.6 edition: http://www.zope.org/Documentation/Books/ZopeBook/2_6Edition/ScriptingZope.st... Theres an example where a parameter gets passed to an External Method hth peter. Sorin Marti wrote:
Andreas Jung wrote:
You can not start shell skripts from Zope. At least on directly. Create an ExternalMethod that starts your script using os.system() or os.popen(). Check with the Zope Book for details.
-aj
First of all: Thanks to Andreas for answering my questions all the time!
I read stuff in the python manual about os.system() and I read a tutorial about External methods on zope.org
Now I've got following code:
-------------------- def ltoh(self): """Compile TeX-File""" import os msg = os.system( 'latex2html /home/mas/test.tex' ) if msg == 0: return 'Successfull' else: return 'Not Successfull'
--------------------
That works fine. Now I want to pass a parameter (the filename) and that doesn't work.
How do I pass parameters? I tried a few things but nothing worked... A link to a good tutorial or manual would be great also.
Thanks in Advance -mas
Try the example here. http://www.zope.org/Members/pbrunet/ExternalMethodsBasicSummary -----Original Message----- From: zope-admin@zope.org [mailto:zope-admin@zope.org]On Behalf Of Sorin Marti Sent: 07 March 2003 13:20 To: Andreas Jung; zope@zope.org Subject: Re: [Zope] Executing Scripts in Zope Andreas Jung wrote:
You can not start shell skripts from Zope. At least on directly. Create an ExternalMethod that starts your script using os.system() or os.popen(). Check with the Zope Book for details.
-aj
First of all: Thanks to Andreas for answering my questions all the time! I read stuff in the python manual about os.system() and I read a tutorial about External methods on zope.org Now I've got following code: -------------------- def ltoh(self): """Compile TeX-File""" import os msg = os.system( 'latex2html /home/mas/test.tex' ) if msg == 0: return 'Successfull' else: return 'Not Successfull' -------------------- That works fine. Now I want to pass a parameter (the filename) and that doesn't work. How do I pass parameters? I tried a few things but nothing worked... A link to a good tutorial or manual would be great also. Thanks in Advance -mas _______________________________________________ Zope maillist - Zope@zope.org http://mail.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://mail.zope.org/mailman/listinfo/zope-announce http://mail.zope.org/mailman/listinfo/zope-dev )
Am Freitag, 7. März 2003 14:20 erhalten:
Now I've got following code:
-------------------- def ltoh(self): """Compile TeX-File""" import os msg = os.system( 'latex2html /home/mas/test.tex' ) if msg == 0: return 'Successfull' else: return 'Not Successfull'
--------------------
seems to be a class method (self ?) if not, call from a python scipt inside zope print container.Itoh(param) return printed fritz (-:fs)
On Fri, Mar 07, 2003 at 11:37:47AM +0100, Sorin Marti wrote:
If I want to execute this script, how do I do that?
Install ZShellScripts, they are made for these. get them at : http://www.librelogiciel.com/software/ Please get the CVS version which features some fixed bugs and support for bash, python, lisp, perl, php and now ruby ! access to zope variables is "semi" transparent. bye, Jerome Alet
participants (6)
-
Andreas Jung -
fritz steindl -
Jerome Alet -
Micheál Healy -
Peter Sabaini -
Sorin Marti