Running a script python from JAVA

Bjorn Pettersen bjorn at roguewave.com
Thu Feb 3 14:18:21 EST 2000


Not a solution, just a greater appreciation for the Python indentation == block
syntax :-)

-- bjorn

Alain wrote:

> Hi,
>
> I'm trying to run a script from a file. The script is written in python. The
> script is a telnet session between a router and a computer. If I run the
> script from a DOS prompt window, everything is good. But if I start the
> script from my program, using a Runtime object, there's a problem. The
> communication between the router and the computer is stop, even if the
> telnet session is still open. Here's the code:
>
> private void runPython(String fileName, String aDevice) { try { Process
> process; Runtime runtime = Runtime.getRuntime(); String os =
> System.getProperty( "os.name" ); if ( os.equals( "Windows 95" )) { String
> cmd = "start python " + fileName; process=runtime.exec(cmd); } else if
>  os.equals( "Windows NT" )) { String cmd = "cmd /C \"start python " +
> fileName + "\""; runtime.exec( cmd ); } } catch (IOException e)
>  writeToLogFile("Telnet to: "+aDevice+" failled: "+e.getMessage()); } }
>
> Is there someone have a solution?
>
> Thanks,
>
> Alain
>
> --
> http://www.python.org/mailman/listinfo/python-list





More information about the Python-list mailing list