Package org.python.util

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


    }
    logger.info("Setting Python Scripts Directory for karma-cleaning: " + dirpathString);
   
    interpreter.exec("import sys");
    // /Users/bowu/projects/IDCT/src/edu/isi/karma/cleaning
    interpreter.exec("sys.path.append('" + dirpathString + "')");
    interpreter.exec("from FunctionList import *");
    interpreter.exec("from Interpreter import *");
    // interpreter.exec("print sys.path");
    interpreterClass = interpreter.get("Interpreter");
  }
View Full Code Here


    logger.info("Setting Python Scripts Directory for karma-cleaning: " + dirpathString);
   
    interpreter.exec("import sys");
    // /Users/bowu/projects/IDCT/src/edu/isi/karma/cleaning
    interpreter.exec("sys.path.append('" + dirpathString + "')");
    interpreter.exec("from FunctionList import *");
    interpreter.exec("from Interpreter import *");
    // interpreter.exec("print sys.path");
    interpreterClass = interpreter.get("Interpreter");
  }

View Full Code Here

   
    interpreter.exec("import sys");
    // /Users/bowu/projects/IDCT/src/edu/isi/karma/cleaning
    interpreter.exec("sys.path.append('" + dirpathString + "')");
    interpreter.exec("from FunctionList import *");
    interpreter.exec("from Interpreter import *");
    // interpreter.exec("print sys.path");
    interpreterClass = interpreter.get("Interpreter");
  }

  /**
 
View Full Code Here

   {
      final PythonInterpreter interp = this.getInitializedInterpreter();
      this.currentInterpreter = interp;
      try
      {
         interp.exec(this.textArea.getText());
      }
      catch (Exception e)
      {
         if (displayError)
         {
View Full Code Here

    * @return A new interpreter.
    */
   private PythonInterpreter getInitializedInterpreter()
   {
      final PythonInterpreter interp = new PythonInterpreter();
      interp.exec("from maze.ai import RobotStep");
      interp.exec("from maze.model import Direction, MazeCell");
      interp.set("Forward", RobotStep.MoveForward);
      interp.set("Back", RobotStep.MoveBackward);
      interp.set("Left", RobotStep.RotateLeft);
      interp.set("Right", RobotStep.RotateRight);
View Full Code Here

    */
   private PythonInterpreter getInitializedInterpreter()
   {
      final PythonInterpreter interp = new PythonInterpreter();
      interp.exec("from maze.ai import RobotStep");
      interp.exec("from maze.model import Direction, MazeCell");
      interp.set("Forward", RobotStep.MoveForward);
      interp.set("Back", RobotStep.MoveBackward);
      interp.set("Left", RobotStep.RotateLeft);
      interp.set("Right", RobotStep.RotateRight);
      //We create and set a dummy maze variable so the user can analyze its methods.
View Full Code Here

        = "cw = "+cw+"()\n"
        + (null!=context?"cw._setContext( context )\n":"")
        + "cw.main( sys.argv )\n"
        + "result = cw._getResult()\n"
        ;
      pi.exec( jythonexec );
      WayPointRecorder.add( BasicWayPoint.ExecutingCodeWriter.make( template.getCodeWriterPath().getAbsolutePath() ) );

      Object result = pi.get("result");

      if( result instanceof Integer ) {
View Full Code Here

        PythonInterpreter interp = createInterpreterWithArgs(xmlReportFile);

        LOGGER.info("About to call Jython test script: " + protonScriptFile + " with parent directory added to Jython path");

        interp.exec(
        "import sys\n"+
        "sys.path.insert(0,\""+parentDirectory+"\")\n"
        );

        try
View Full Code Here

                            PySystemState.add_extdir(jarDir);
                        }
                    }

                    PythonInterpreter interpreter = new PythonInterpreter();
                    interpreter.exec(script);
                    return null;
                }
            });
        } catch (PrivilegedActionException e) {
            logger.error(e.getMessage(), e);
View Full Code Here

            // If URL is of type file, assume that we are in dev env and set path to python dir.
            // 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 {
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.