Running external Python
hi,
I am trying to run external Python (2.5) in SOA 6.1.
The script works fine from command line.
I have added Python.Home to Window>Preferences > Scripting > Python > C:\Python25
When trying to run script from SOA,
test looks inactive and reports a message "Test was not ready and did not run"
Here is the python script:
************************************************
import gzip
f_in = open('C:\\Python25\\file.txt', 'rb')
f_out = gzip.open('C:\\Python25\\file.txt.gz', 'wb')
f_out.writelines(f_in)
f_out.close()
f_in.close()
************************************************
Lech
I am trying to run external Python (2.5) in SOA 6.1.
The script works fine from command line.
I have added Python.Home to Window>Preferences > Scripting > Python > C:\Python25
When trying to run script from SOA,
test looks inactive and reports a message "Test was not ready and did not run"
Here is the python script:
************************************************
import gzip
f_in = open('C:\\Python25\\file.txt', 'rb')
f_out = gzip.open('C:\\Python25\\file.txt.gz', 'wb')
f_out.writelines(f_in)
f_out.close()
f_in.close()
************************************************
Lech
0
Comments
It is possible to run Python 2.5 (or any other executable) with "External Tool"
As I have learned from Parasoft Support, the builit in version of Python is 2.2.1,
so if your script will not work with Python 2.2.1, will not work as well in SOATest
Another option is using Jython, which doesnt require anything to be installed,
because it is mixture of Java (which is pre-requisite of SOA) and pyton 2.2.1
and you can use python syntax (which is simple) and java classes, which allows doing advanced things, example:
from java.util.zip import *
from java.io import *
def main():
input = BufferedReader(FileReader("./request.xml"))
output = BufferedOutputStream(GZIPOutputStream(FileOutputStream("./request.gz")))
line = input.readLine()
while line != None:
output.write(line+"\r\n")
line = input.readLine()
input.close()
output.close()