Package modbuspal.toolkit

Source Code of modbuspal.toolkit.Jythools

/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/

package modbuspal.toolkit;

import org.python.core.PyObject;
import org.python.util.PythonInterpreter;

/**
* various tools for Jython
* @author nnovic
*/
public class Jythools
{
    /**
     * Execute the specified python script and gets the named object from the
     * interpreter
     * @param fileName the script file
     * @param objectName the name of the object to obtain
     * @return the designated object, or null
     */
    public static PyObject getFromFile(String fileName, String objectName)
    {
        System.out.println("jythools: get "+objectName+" from file "+fileName);
        PythonInterpreter interp = new PythonInterpreter();
        interp.execfile(fileName);
        return interp.get(objectName);
    }
}
TOP

Related Classes of modbuspal.toolkit.Jythools

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.