Examples of PySystemState


Examples of org.python.core.PySystemState

        putPythonProperty( PYTHON_HOME, props);
        putPythonProperty( PYTHON_PATH, props);
        PythonInterpreter.initialize( System.getProperties(), props, new String[0] );

        interpreter = new PythonInterpreter(null, new PySystemState());
        interpreter.setErr( new LogWriter( Level.SEVERE ) );
        interpreter.setOut( new LogWriter( Level.INFO ) );
//        PySystemState sys = Py.getSystemState();
//        sys.path.append(new PyString(rootPath));
        return true;
View Full Code Here

Examples of org.python.core.PySystemState

        if (reader != null) {
            reader.addLogListener(listener);
        }
       
        Py.initPython();
        PySystemState sys = Py.getSystemState();
        sys.setClassLoader(this.getClass().getClassLoader());
       
        Dictionary headers = context.getBundle().getHeaders();
        String importPackages = (String)headers.get("Import-Package");
        if(importPackages!=null) {
            String[] result = importPackages.split(",");
View Full Code Here

Examples of org.python.core.PySystemState

   public static PythonInterpreter getPythonInterpreter()
   {
      if (interpreter == null)
      {
         interpreter = new PythonInterpreter();
         PySystemState sys = Py.getSystemState();
         sys.add_package("javax.management");
         sys.add_package("javax.management.loading");
         sys.add_package("javax.management.modelmbean");
         sys.add_package("javax.management.monitor");
         sys.add_package("javax.management.openmbean");
         sys.add_package("javax.management.remote");
         sys.add_package("javax.management.remote.rmi");
         sys.add_package("javax.management.relation");
         sys.add_package("javax.management.timer");
         try
         {
            String script = loadStream(JythonRunner.class.getClassLoader().getResourceAsStream("mx4j/tools/jython/jmxUtils.py"));
            interpreter.exec(script);
         }
View Full Code Here

Examples of org.python.core.PySystemState

        return permissions == null ? eng : new SandboxedScriptEngine(eng, permissions);
    }

    @Override
    public void installScriptSourceProvider(ScriptEngine scriptEngine, ScriptSourceProvider provider) {
        PySystemState sys = Py.getSystemState();
        if (sys != null) {
            sys.path_hooks.append(new PythonSourceProvider(provider));
        }
    }
View Full Code Here

Examples of org.python.core.PySystemState

        implementation = impl;
        pxFactory = pxf;
    }

    public void start() {
        final PySystemState pss = new PySystemState();
        pss.path.insert(0, new PyString(implementation.getLocation()));
        pss.path.insert(0, new PyString(getClass().getProtectionDomain().getCodeSource().getLocation().getFile()));
        python = new PythonInterpreter(null, pss);
        python.exec("from invoker import *");

 
View Full Code Here

Examples of org.python.core.PySystemState

     *
     * @see #EditorConfig()
     */
    public EditorConfig(List<String> jarLocations)
            throws PythonException {
        pyInterp = new PythonInterpreter(null, new PySystemState());
        PySystemState pySysStat = Py.getSystemState();

        // Add all "jarLocations/Lib" to sys.path
        if(jarLocations != null)
            for(String jarPath : jarLocations)
                pySysStat.path.append(new PyString(jarPath + "/Lib"));
View Full Code Here

Examples of org.python.core.PySystemState

                      argv = (String[])ObjectSerializer.deserialize(
                              pigContext.getProperties().getProperty(PigContext.PIG_CMD_ARGS_REMAINDERS));
                  } catch (IOException e) {
                      throw new ExecException("Cannot deserialize command line arguments", e);
                  }
                  PySystemState  state = Py.getSystemState();
                  state.argv.clear();
                  if( argv != null ) {
                    for (String str : argv ) {
                      state.argv.append(new PyString(str));
                    }
View Full Code Here

Examples of org.python.core.PySystemState

                      argv = (String[])ObjectSerializer.deserialize(
                              pigContext.getProperties().getProperty(PigContext.PIG_CMD_ARGS_REMAINDERS));
                  } catch (IOException e) {
                      throw new ExecException("Cannot deserialize command line arguments", e);
                  }
                  PySystemState  state = Py.getSystemState();
                  state.argv.clear();
                  if( argv != null ) {
                    for (String str : argv ) {
                      state.argv.append(new PyString(str));
                    }
View Full Code Here

Examples of org.python.core.PySystemState

        }
    }

    private PythonInterpreter createInterpreterWithArgs(String xmlReportFile, String ignoreFile)
    {
        PySystemState systemState = new PySystemState();

        if (xmlReportFile != null)
        {
            systemState.argv.append(new PyString("--xml"));
            systemState.argv.append(new PyString(xmlReportFile));
View Full Code Here

Examples of org.python.core.PySystemState

      Properties jythonProps = new Properties();
      jythonProps.put( "python.home", tmps.get("jython.home") );
      PythonInterpreter.initialize( System.getProperties(), jythonProps, args );

      PyStringMap       dict  = new PyStringMap();
      PySystemState     pysys = new PySystemState();
      PythonInterpreter pi    = new PythonInterpreter( dict, pysys );


      // DO NOT use CommandLineUserMessageHandler here - causes infinite recursion
      MessageHandlerOutputStream  out  = new MessageHandlerOutputStream( UserMessageHandler.INFO,  rumh );
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.