[Zope] calling os.system using external method
Dieter Maurer
dieter@handshake.de
Fri, 27 Jun 2003 00:36:45 +0200
Mike Doanh Tran wrote at 2003-6-24 15:57 -0600:
> I have an External method that uses os.system to execute
> a linux command on a local host. I am trying to pass a file name
> to the findDocs function (see below) to locate the location (path) of the
> wanted file and print it out on a dtml document. Can someone please show me
> how to make this work?
>
> Thanks in advanced for any suggestions.
>
> #Python script to find location/path of local file
> import os
> unixCommand = 'find /home/uploads/ -name %'
> def findDocs(arg):
> os.system(unixCommand%arg)
>
> DTML:
> <dtml-call "externalMethodName(arg=fileName)">
Your "unixCommand" should read:
unixCommand = 'find /home/uploads/ -name %s'
^
Zope/Pythons error messages (and tracebacks) are quite good.
Careful reading usually points out the problem cause.
In your case, I expect you got the message "not all arguments converted"
which means: "%" got arguments for which there were not format specifies.
Dieter