Package org.python.core

Examples of org.python.core.PyObject.invoke()


                  pyargs[i] = Py.java2py(args[i]);
          }

          if (object != null) {
              PyObject o = Py.java2py(object);
              return unwrap(o.invoke(method, pyargs));
          }

          PyObject m = interp.get(method);

          if (m == null)
View Full Code Here


    public void runFixtureSetup() {
        invokeAndWaitForWindow(new Runnable() {
            public void run() {
                PyObject fixture = getFixture();
                try {
                    fixture.invoke("setup");
                    runMain();
                } catch (Throwable t) {
                    t.printStackTrace();
                    synchronized (PythonScript.this) {
                        PythonScript.this.notifyAll();
View Full Code Here

            }
        });
        PyObject fixture = getFixture();
        if (fixture.__findattr__("test_setup") != null) {
            try {
                fixture.invoke("test_setup");
            } catch (Throwable t) {
                if (t instanceof PyException)
                    raisePythonError((PyException) t);
                throw new ScriptException("Could not invoke test_setup: " + t.getMessage());
            }
View Full Code Here

                    "        return self.val");
        PyObject blahClass = interp.get("Blah");
        int base = 42;
        PyObject blahInstance = blahClass.__call__(new PyInteger(base));
        for (int i = 0; i < 4; i++) {
            assertEquals(++base, blahInstance.invoke("incval").__tojava__(Integer.class));
        }
    }
}
View Full Code Here

    }

    private void setI18NJar(String pyLocation) {
        interpreter.exec("import sos");
        PyObject sos = interpreter.get("sos");
        sos.invoke("set_i18n", new PyString(pyLocation));
    }

    private void addToJythonPath(String location) {
        sysPath.invoke("append", new PyString(location));
    }
View Full Code Here

    private void addContribScriptsToPath(String contrib) {
        addToJythonPath(contrib);
        interpreter.exec("import sos.plugins");
        interpreter.exec("sos_path = sos.plugins.__path__");
        PyObject sosModulePath = interpreter.get("sos_path");
        sosModulePath.invoke("append", new PyString(contrib));
        addJarsToJythonPath(sosModulePath, contrib);
    }

    private void addJarsToJythonPath(PyObject sosModulePath, String contribPath) {
        File contrib = new File(contribPath);
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.