calling a java app from python
Anoop P B
anoop79 at myrealbox.com
Mon Jul 1 02:43:39 EDT 2002
is there no way of doing this cross-platform?
(i have changed the subject of this post since this subject may draw
better attention and hold greater interest to others as well. please
read my original post below....)
Matt Gerrans wrote:
> If you are not averse to using the Win32 extensions on the Windows
platform,
> then win32api.WinExec() or win32api.ShellExecute() will do the job quite
> nicely.
>
>
My original post:
_____________________
Hi,
I am trying to call a java application through my python script on
windows. After consulting the documentation, i quickly learnt that the
os.spawn*p versions are not available on windows. so, i tried the following:
os.spawnle(os.P_NOWAIT, "java.exe", "java", "testProg", "testParam",
os.environ)
As I understand, this should work by picking up the path system variable
from os.environ for setting up the environment for the new process (or
am I missing something here?). But what I get is....
Traceback (most recent call last):
File "server.py", line 48, in ?
ct.run()
File "server.py", line 25, in run
os.spawnle(os.P_NOWAIT, "java.exe", "java", "testProg",
"testParam", os.environ)
File "c:\python22\lib\os.py", line 541, in spawnle
return spawnve(mode, file, args[:-1], env)
OSError: [Errno 2] No such file or directory
Can someone please throw some light on possible solutions to this
problem. My ultimate aim is only to run the java program through my
python script. However, I cannot use os.system() since my python program
gets blocked which is not acceptable. I need my python script to call
the java program and continue executing.
Thanks in advance,
Anoop
note: the java class is in the same directory in which my python script lies
More information about the Python-list
mailing list