Package org.python.util

Examples of org.python.util.PythonInterpreter.exec()


            // else use the jar file as is
            jarPath = jarPath + "../../src/main/python/";
        }

        p.exec("import sys");
        p.exec("sys.path.append('" + jarPath + "')");
        p.exec("from debugserver import run_server");
        if (this.host == null) {
          p.exec("run_server(port=" + this.port + ", locals=locals())");
        } else {
          p.exec("run_server(port=" + this.port + ", host='" + this.host + "', locals=locals())");
View Full Code Here


            jarPath = jarPath + "../../src/main/python/";
        }

        p.exec("import sys");
        p.exec("sys.path.append('" + jarPath + "')");
        p.exec("from debugserver import run_server");
        if (this.host == null) {
          p.exec("run_server(port=" + this.port + ", locals=locals())");
        } else {
          p.exec("run_server(port=" + this.port + ", host='" + this.host + "', locals=locals())");
        }
View Full Code Here

        p.exec("import sys");
        p.exec("sys.path.append('" + jarPath + "')");
        p.exec("from debugserver import run_server");
        if (this.host == null) {
          p.exec("run_server(port=" + this.port + ", locals=locals())");
        } else {
          p.exec("run_server(port=" + this.port + ", host='" + this.host + "', locals=locals())");
        }
    }
}
View Full Code Here

        p.exec("sys.path.append('" + jarPath + "')");
        p.exec("from debugserver import run_server");
        if (this.host == null) {
          p.exec("run_server(port=" + this.port + ", locals=locals())");
        } else {
          p.exec("run_server(port=" + this.port + ", host='" + this.host + "', locals=locals())");
        }
    }
}
View Full Code Here

*/
public class UnlinkedJythonOperationsImpl implements UnlinkedJythonOperations {
   
    public void execute(String script, Map vars) throws BuildException {
        PythonInterpreter pi = createInterpreter(vars);
        pi.exec(script);
    }

    public void execute(File file, Map vars) throws BuildException {
        PythonInterpreter pi = createInterpreter(vars);
        try {
View Full Code Here

              state.path.insert(1, Py.newString(basePath + "lib" + File.separator + filename));
            }
          }
        }
        PythonInterpreter interp = new PythonInterpreter(null, state);
        interp.exec(strScript);
        PyObject getInstance = interp.get("getInstance");
        if (!(getInstance instanceof PyFunction)) {
          throw new ScriptCompilationException("\"getInstance\" is not a function.");
        }
        PyObject _this;
View Full Code Here

        }

        File classesDir = new File(basedir, "target/classes");
        PythonInterpreter interp = new PythonInterpreter();

        interp.exec(
        "import sys\n"+
        "sys.path.insert(0,\""+classesDir.getCanonicalPath()+"\")\n"+
        "sys.path.insert(0,\""+testDir.getCanonicalPath()+"\")\n"
        );
View Full Code Here

                // We import the Python SYS module. Now we don't need to do this
                // explicitely in the script.  We always use the sys module to
                // do stuff like loading java package
                // org.apache.turbine.services.assemblerbroker.util.python;
                interp.exec("import sys");

                // Now we try to load the script file
                interp.execfile(confName);
                interp.execfile(fName.toString());
View Full Code Here

                try
                {
                    // We create an instance of the screen class from the
                    // python script
                    interp.exec("scr = " + name + "()");
                }
                catch (Throwable e)
                {
                    throw new Exception(
                        "\nCannot create an instance of the python class.\n"
View Full Code Here

              state.path.insert(1, Py.newString(basePath + "lib" + File.separator + filename));
            }
          }
        }
        PythonInterpreter interp = new PythonInterpreter(null, state);
        interp.exec(strScript);
        PyObject getInstance = interp.get("getInstance");
        if (!(getInstance instanceof PyFunction)) {
          throw new ScriptCompilationException("\"getInstance\" is not a function.");
        }
        PyObject _this;
View Full Code Here

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.