[Zope-dev] Extrenal method unable to run the os.popen() or os.system() commands

Wichert Akkerman wichert at wiggy.net
Wed Feb 14 04:44:31 EST 2007


Previously Ridzwan Aminuddin wrote:
> Hi!
> 
> Thanks for your reply.
> 
> I heeded your advice and tried fooling around with the stderr. Apparently even if i set the classpath through my execution statement i.e :
> 
>    command = "java -jar -classpath "/var/lib/zope2.8/instance/plone-site/Extensions/ test.jar"
>    os.system(command)
> 
> it doesn't seem to work. Because even though i have denoted the path to the jar file, this python external method requires me to be in the atual working directory in order o sucessfully run this command.
> 
> What i tried was to write a shell script instead
> 
>    #!/bin/bash
>    # My shell script
>    path='/var/lib/zope2.8/instance/plone-site/Extensions'
>    cd $path
>    java -jar test.jar
> 
> 
> this shell script is executed by my external method :
> 
>    command = "home/ewan/myScript"
>    os.system(command)
> 
> This works perfectly. So now i know it has to do with the physical working directory i am in. Simply setting the classpath doesn't work or giving the absolute path to the jar file doesn't work either.
> 
> i.e : 
> 
>    command = "java -jar /var/lib/zope2.8/instance/plone-site/Extensions/test.jar"
>    os.system(command)
> 
> Anyone knows why this is so? and is there any way around this? I find
> it inefficient that i have my DTML calling My Python calling a Shell
> Script that runs an executable. Such a long chain! 

That is due to something in your java setup or java application, not
something in Zope. So we can't help you with that.

Wichert.

-- 
Wichert Akkerman <wichert at wiggy.net>    It is simple to make things.
http://www.wiggy.net/                   It is hard to make things simple.


More information about the Zope-Dev mailing list