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

Ridzwan Aminuddin wanster at inbox.com
Fri Feb 9 20:39:58 EST 2007


Hi,

Since you say changing the working environment in zope is dangerous, is there any way around for what i need to do?

Is there a way i can find out the exact directory zope is on at that moment? and if i can find it is it a good idea for me to place the additional files i need to run my .jar in that directory?

Or should i just do everything in an absolute path method?

i.e when i wanna run my jar instead of using this as my "command"

java -jar ActivelearningTools.jar >> output.txt

I will do:

java -jar /var/lib/zope2.8/instance/plone-site/Extensions/ActiveLearningTools.jar >> /var/lib/zope2.8/instance/plone-site/Extensions/output.txt

Thanks in advance!

wan
 
> -----Original Message-----
> From: dieter at handshake.de
> Sent: Fri, 9 Feb 2007 19:58:06 +0100
> To: wanster at inbox.com
> Subject: Re: [Zope-dev] Extrenal method unable to run the os.popen() or
> os.system() commands
> 
> Ridzwan Aminuddin wrote at 2007-2-9 00:47 -0800:
>> ...
> >	command = "cd "+homedir
> >	os.popen(command)
> 
> This "popen" is useless.
> 
>   It will change the working directory in the new (!) process that
> executes
>   "command". But the effect is lost as soon as the process ends (after
> the
>   "cd" has been executed).
> 
>   "os.popen('cd ...')" will not affect the working directory
>   of the Zope process (or any later 'os.popen').
> 
> 
> Be warned: you should *not* change Zope's working directory.
> Changing global resources (such as the working directory) is
> dangerous in a multi thread environment (such as Zope).
> 
> 
> 
> --
> Dieter


More information about the Zope-Dev mailing list