Package org.python.util

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


      PythonInterpreter pi = new PythonInterpreter();

      // Standard Imports
      pi.exec("from com.dbxml.db.core import Database");
      pi.exec("from com.dbxml.db.core import Collection");
      pi.exec("from com.dbxml.db.core import Container");
      pi.exec("from com.dbxml.db.common.scripting import *");
      pi.exec("from org.w3c.dom import *");
      pi.exec("from com.dbxml.xml import *");

      // Standard Variables
View Full Code Here


      // Standard Imports
      pi.exec("from com.dbxml.db.core import Database");
      pi.exec("from com.dbxml.db.core import Collection");
      pi.exec("from com.dbxml.db.core import Container");
      pi.exec("from com.dbxml.db.common.scripting import *");
      pi.exec("from org.w3c.dom import *");
      pi.exec("from com.dbxml.xml import *");

      // Standard Variables
      pi.set("this", this);
View Full Code Here

      // Standard Imports
      pi.exec("from com.dbxml.db.core import Database");
      pi.exec("from com.dbxml.db.core import Collection");
      pi.exec("from com.dbxml.db.core import Container");
      pi.exec("from com.dbxml.db.common.scripting import *");
      pi.exec("from org.w3c.dom import *");
      pi.exec("from com.dbxml.xml import *");

      // Standard Variables
      pi.set("this", this);
      pi.set("database", collection.getDatabase());
View Full Code Here

      pi.exec("from com.dbxml.db.core import Database");
      pi.exec("from com.dbxml.db.core import Collection");
      pi.exec("from com.dbxml.db.core import Container");
      pi.exec("from com.dbxml.db.common.scripting import *");
      pi.exec("from org.w3c.dom import *");
      pi.exec("from com.dbxml.xml import *");

      // Standard Variables
      pi.set("this", this);
      pi.set("database", collection.getDatabase());
      pi.set("collection", collection);
View Full Code Here

         Object obj = args.get(names[i]);
         pi.set(names[i], obj);
      }

      // Now run the actual script
      pi.exec(script);

      // Return any possible result
      Object res = pi.get("result");
    if ( res != null )
      return new Variant(res);
View Full Code Here

    private void lazilyLoadGamerStub() {
      if (thePythonGamer == null) {
          try {
              // Load in the Python gamer, using a Jython intepreter.
              PythonInterpreter interpreter = new PythonInterpreter();
              interpreter.exec("from " + getPythonGamerModule() + " import " + getPythonGamerName());
              PyObject thePyClass = interpreter.get(getPythonGamerName());
              PyObject PyGamerObject = thePyClass.__call__();
              thePythonGamer = (Gamer)PyGamerObject.__tojava__(Gamer.class);
          } catch(Exception e) {
              GamerLogger.logError("GamePlayer", "Caught exception in Python initialization:");
View Full Code Here

* @author Sam
*/
public class PythonConsole {
    public static void main(String[] args) {
        PythonInterpreter interpreter = new PythonInterpreter();
        interpreter.exec("from scripts import *");
        interpreter.exec("import external.JythonConsole.console");
        interpreter.exec("external.JythonConsole.console.main(locals())");
    }
}
View Full Code Here

*/
public class PythonConsole {
    public static void main(String[] args) {
        PythonInterpreter interpreter = new PythonInterpreter();
        interpreter.exec("from scripts import *");
        interpreter.exec("import external.JythonConsole.console");
        interpreter.exec("external.JythonConsole.console.main(locals())");
    }
}
View Full Code Here

public class PythonConsole {
    public static void main(String[] args) {
        PythonInterpreter interpreter = new PythonInterpreter();
        interpreter.exec("from scripts import *");
        interpreter.exec("import external.JythonConsole.console");
        interpreter.exec("external.JythonConsole.console.main(locals())");
    }
}
View Full Code Here

        "def get_ival(foo):\n" +
        "    return foo.ival\n" +
        "";

    PythonInterpreter interpreter = new PythonInterpreter();
    interpreter.exec(jython);

    PyObject fooClass = interpreter.get("Foo");
    assertTrue(fooClass instanceof PyClass);

    PyObject getMapFunc = interpreter.get("get_map");
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.