0

I'm new on GWT and i have an application developed on GWT. I need integrates a program on the server side that was developed with python. The application developed with python must take a MalLab file and then produce some files on format .PNG. For the moment i made changes on the python program, because it must take the file on an specific URL. How you one idea for integrates a GWT application with python on the server side?.

The program in python is:

#!/usr/bin/python
# -*- coding: utf-8 -*-
import scipy.io
import pylab as pl
import numpy as np
from scipy import misc
from glob import glob

# import file into a dictionary
fMatLab = scipy.io.loadmat('St3D', mat_dtype = True, squeeze_me = True, struct_as_record=False)

# read in the structure
data = fMatLab['St3D']

for i in range(data.shape[2]):
    misc.imsave('transect_%s.png' % i, data[:,:,i] )
    img = scipy.misc.toimage(data[:,:,i], mode='I')
user3410517
  • 295
  • 3
  • 18
  • Nothing special about GWT here. Just use something like [this](http://stackoverflow.com/questions/10097491/call-and-receive-output-from-python-script-in-java). – Baz Sep 25 '14 at 15:00
  • there is nothing special with gwt server side, all what you need is to integrate your python script with java, i used jython for that, other thing what you could create rest server in pythhon, and call it directlu from gwt frond end – user902383 Sep 25 '14 at 15:17
  • how make it: `you could create rest server in pythhon, and call it directlu from gwt frond end` Could you develop more this idea, please – user3410517 Sep 26 '14 at 15:37

1 Answers1

0

All you need to do on the RemoteServlet is write few lines of java code to execute your script

String[] cmd = {
    "/bin/bash",
    "-c",
    "python script.py \"" + path_to_matlab_file + "\""
};
Runtime.getRuntime().exec(cmd);
NRJ
  • 1,064
  • 3
  • 15
  • 32
  • Where i placed my "script.py program" ? When running the services I have a java.security.AccessControlException: access denied ("java.io.FilePermission" "<>" "execute") – user3410517 Sep 26 '14 at 15:40