繁体   English   中英

服务器端的GWT和python

[英]GWT and python on the server side

我是GWT的新手,我有一个在GWT上开发的应用程序。 我需要在服务器端集成一个用python开发的程序。 使用python开发的应用程序必须获取MalLab文件,然后生成.PNG格式的文件。 目前,我在python程序上进行了更改,因为它必须将文件放在特定的URL上。 您如何在服务器端将GWT应用程序与python集成?

python中的程序是:

#!/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')

您在RemoteServlet上需要做的就是编写几行Java代码来执行脚本

String[] cmd = {
    "/bin/bash",
    "-c",
    "python script.py \"" + path_to_matlab_file + "\""
};
Runtime.getRuntime().exec(cmd);

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM