[Zope-dev] Extrenal method unable to run the os.popen() or
os.system() commands
Ridzwan Aminuddin
wanster at inbox.com
Fri Feb 9 20:53:25 EST 2007
Oh yes, i forgot to mention that in my code i did use the absolute paths to my java .jar file as you can see i my code below, the absolute path to the Extensions directory is in the variable homedir. I also set my classpath to point to the folder just in case..
Any ideas why it won't work? and any suggestions for workarounds?
Thanks!
homedir = os.getcwd()
homedir = homedir + "/Extensions"
command = "cd "+homedir
os.popen(command)
command = "java -jar "+ '"' + homedir + "/" + "ActiveLearningTools.jar" + '" ' +
"prepArticles >> test.txt"
os.popen(command)
> -----Original Message-----
> From: wanster at inbox.com
> Sent: Fri, 9 Feb 2007 17:39:58 -0800
> To: dieter at handshake.de
> Subject: Re: [Zope-dev] Extrenal method unable to run the os.popen() or
> os.system() commands
>
> 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
> _______________________________________________
> Zope-Dev maillist - Zope-Dev at zope.org
> http://mail.zope.org/mailman/listinfo/zope-dev
> ** No cross posts or HTML encoding! **
> (Related lists -
> http://mail.zope.org/mailman/listinfo/zope-announce
> http://mail.zope.org/mailman/listinfo/zope )
More information about the Zope-Dev
mailing list