Examples of PythonInterpreter


Examples of org.python.util.PythonInterpreter

                                    // solve import statements.
                                    PySystemState.add_extdir(jarDir);
                                }
                            }

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

Examples of org.python.util.PythonInterpreter

        try {
            String testCasename = m_ScriptFileDir.getCanonicalPath();
            // get the current TestSuitesDirectory
            m_TestSuiteDir = m_TestSuiteDir.replace("\\", "/");
            StringWriter output = new StringWriter();
            PythonInterpreter interp = new PythonInterpreter(new org.python.core.PyStringMap(), new org.python.core.PySystemState());
            interp.setOut(output);
            interp.setErr(output);
            interp.cleanup();
            //java -cp %JYTHON_HOME%\jython.jar -Dpython.home=%JYTHON_HOME% -Dpython.path=%FORMATTER_DIR% org.python.util.jython %JYTHON_HOME%\Lib\pythondoc.py -f -s -Otestscriptdoc_xmlformatter -Dtestsuite_dir=%TEST_SUITE_DIR% !TEST_SCRIPTS!           
            String args = "import sys;sys.argv[1:]= ['-f', '-s', '-Otestscriptdoc_xmlformatter'";
            if (new File(m_TestSuiteDir).getCanonicalFile() == new File("TestSuites").getCanonicalFile()) {
              args += ",\"-DrootTestSuiteDir=" + m_TestSuiteDir + "\"";
            }
            args+=", r'" + testCasename + "']";
            interp.exec(args);
            interp.exec("__name__ = '__main__'");
            interp.exec("execfile(r'" + StaticConfiguration.JYTHON_LIB + "/pythondoc.py')");
            interp.cleanup();
            interp = null;
            if (xmlDocFile.exists()) {
                final String[] args2 = new String[]{"-XSLTC", "-XT", "-IN", xmlDocFilename, "-XSL", StaticConfiguration.TEST_SCRIPT_DOC_TOOLS_DIR + "/testscriptdoc_xml2html.xsl", "-OUT", htmlDocFilename};
                org.apache.xalan.xslt.Process.main(args2);
                xmlDocFile.delete();
View Full Code Here

Examples of org.python.util.PythonInterpreter

        try {
            Properties properties = new Properties();
            properties.setProperty("python.home", StaticConfiguration.JYTHON_HOME);
            properties.setProperty("python.path", StaticConfiguration.FORMATTER_DIR);
            PythonInterpreter.initialize(System.getProperties(), properties, new String[]{""});
            PythonInterpreter interp = new PythonInterpreter(new org.python.core.PyStringMap(), new org.python.core.PySystemState());
            interp.setOut(outputs);
            interp.setErr(outputs);
            interp.cleanup();
            //java -cp %JYTHON_HOME%\jython.jar -Dpython.home=%JYTHON_HOME% -Dpython.path=%FORMATTER_DIR% org.python.util.jython %JYTHON_HOME%\Lib\pythondoc.py -f -s -Otestscriptdoc_xmlformatter -Dtestsuite_dir=%TEST_SUITE_DIR% !TEST_SCRIPTS!
            String args = "import sys;sys.argv[1:]= ['-f', '-s', '-Otestscriptdoc_xmlformatter', '-Dtestsuite_dir=" + testSuiteDir.replace(File.separator, "/") + "'," + testScriptsList.toString().replace(File.separator, "/") + "]";
            System.out.println(args);
            interp.exec(args);
            interp.exec("__name__ = '__main__'");
            interp.exec("execfile(r'" + StaticConfiguration.JYTHON_HOME + "/Lib/pythondoc.py')");
            interp.cleanup();
            interp = null;
        }
        catch (Exception e) {
            System.err.println("GenerateTestSuiteDoc - Exception occurs executing PythonInterpreter:" + e.getMessage());
            e.printStackTrace();
View Full Code Here

Examples of org.python.util.PythonInterpreter

        mTimer.cancel();
        mTimer = new Timer("Simulator thread");
        mSimulator = mPySimulator = null;

        mInterpreter = new PythonInterpreter();
        mInterpreter.set("connector", this);
        mInterpreter.exec("import sys; sys.path.append(r'" + StaticConfiguration.JYTHON_LIB + "')");
        try {
            mInterpreter.exec(script);
            if (mSimulator != null) {
View Full Code Here

Examples of org.python.util.PythonInterpreter

            properties.setProperty("python.home", StaticConfiguration.JYTHON_HOME);
            properties.setProperty("python.path", StaticConfiguration.FORMATTER_DIR);
            PythonInterpreter.initialize(System.getProperties(), properties, new String[]{""});
  
            StringWriter output = new StringWriter();
            PythonInterpreter interp = new PythonInterpreter(new org.python.core.PyStringMap(), new org.python.core.PySystemState());

            interp.setOut(output);
            interp.setErr(output);
            interp.cleanup();

            //java -cp %JYTHON_HOME%\jython.jar -Dpython.home=%JYTHON_HOME% -Dpython.path=%FORMATTER_DIR% org.python.util.jython %JYTHON_HOME%\Lib\pythondoc.py -f -s -Otestscriptdoc_xmlformatter -Dtestsuite_dir=%TEST_SUITE_DIR% !TEST_SCRIPTS!
            String args = "import sys;sys.argv[1:]= ['" + directory +  "']";

            interp.exec(args);

            interp.exec("__name__ = '__main__'");

            interp.exec("execfile(r'" + StaticConfiguration.FORMATTER_DIR + "/stepsmoduledoc_xmlformatter.py')");

            interp.cleanup();
            interp = null;
        }
        catch (Exception e) {
            System.err.println("Exception occurs executing PythonInterpreter:" + e.getMessage());
        }
View Full Code Here

Examples of org.python.util.PythonInterpreter

        @Override
        public void actionPerformed(ActionEvent e) {
            MetaCampaignFile selectedCampaign = (MetaCampaignFile) metaCampaignComboBox.getSelectedItem();
            try {
                StringWriter output = new StringWriter();
                PythonInterpreter interp = new PythonInterpreter(new org.python.core.PyStringMap(), new org.python.core.PySystemState());
                interp.setOut(output);
                interp.setErr(output);
                interp.cleanup();
                String args = "import sys;sys.argv[1:]= [r'" + selectedCampaign.getFileName() + "']";
                interp.exec(args);
                interp.exec("__name__ = '__main__'");
                String s =   "execfile(r'tools/TestProcedureDoc/generateTestCampaignDoc.py')";
                interp.exec(s);
                interp.cleanup();
                interp = null;
                File campaingFile = new File(selectedCampaign.getFileName());
                if (campaingFile.exists()) {
                  File resultsFile = new File(campaingFile.getParentFile().getCanonicalPath() + "/" + selectedCampaign.getCampaignName() + "-doc.html");
                  if (resultsFile.exists()) {
View Full Code Here

Examples of org.python.util.PythonInterpreter

*/
public class JPythonInterpreter implements org.apache.batik.script.Interpreter {
    private PythonInterpreter interpreter = null;

    public JPythonInterpreter() {
        interpreter = new PythonInterpreter();
    }
View Full Code Here

Examples of org.python.util.PythonInterpreter

        super(script, classLoader);
    }

    protected PicoContainer createContainerFromScript(PicoContainer parentContainer, Object assemblyScope) {
        try {
            PythonInterpreter interpreter = new PythonInterpreter();
            interpreter.exec("from org.picocontainer.defaults import *");
            interpreter.exec("from org.nanocontainer import *");
            interpreter.exec("from org.nanocontainer.reflection import *");
            interpreter.exec("from java.net import *");
            interpreter.set("parent", parentContainer);
            interpreter.set("assemblyScope", assemblyScope);
            interpreter.execfile(getScriptInputStream(), "nanocontainer.py");
            return (PicoContainer) interpreter.get("pico", PicoContainer.class);
        } catch (IOException e) {
            throw new NanoContainerMarkupException(e);
        }
    }
View Full Code Here

Examples of org.python.util.PythonInterpreter

            properties.setProperty("python.home", workDir.toString());
            properties.setProperty("python.packages.fakepath",
                    (String)avalonContext.get(Constants.CONTEXT_CLASSPATH));
            PythonInterpreter.initialize(System.getProperties(), properties, new String[]{});

            python = new PythonInterpreter();
            python.set("page", this);
            python.set("logger", getLogger());
            python.set("xspAttr", new AttributesImpl());
       
            if (getLogger().isDebugEnabled()) {
View Full Code Here

Examples of org.python.util.PythonInterpreter

      System.setProperty("python.home", System.getProperty("java.io.tmpdir"));
   
    PySystemState.initialize();
    PySystemState.add_extdir(owner.getDesktop().getWebApp().getRealPath("/WEB-INF/lib"), true);
    PySystemState.add_classdir(owner.getDesktop().getWebApp().getRealPath("/WEB-INF/classes"));
    _ip = new PythonInterpreter(new Variables());
  }
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.