Package org.python.core

Examples of org.python.core.PyObject$ConversionException


                interpretBuffer();
            }

            private void interpretBuffer() {
                synchronized(JythonRuntime.this) {
                    PyObject prevOut = systemState.stdout;
                    try {
                        setOut(out);
                        set("env", env);
                        exec(buf.toString());
                        buf.setLength(0);
View Full Code Here


        if(key != null)
        {
            key = key.intern();
        }
       
        PyObject obj = null;
       
        try
        {
            if(wrapper.isAttributesShadowItems())
            {
View Full Code Here

     */
    public TemplateCollectionModel keys() throws TemplateModelException
    {
        try
        {
            PyObject method = object.__findattr__(KEYS);
            if(method == null)
            {
                method = object.__findattr__(KEYSET);
            }
            if(method != null)
            {
                return (TemplateCollectionModel)wrapper.wrap(method.__call__());
            }
        }
        catch(PyException e)
        {
            throw new TemplateModelException(e);
View Full Code Here

     */
    public TemplateCollectionModel values() throws TemplateModelException
    {
        try
        {
            PyObject method = object.__findattr__(VALUES);
            if(method != null)
            {
                return (TemplateCollectionModel)wrapper.wrap(method.__call__());
            }
        }
        catch(PyException e)
        {
            throw new TemplateModelException(e);
View Full Code Here

                        && !(node.getNode().toString().startsWith("'''"));
            }
        });

        if (callNodes[0] instanceof If) {
            PyObject testObject = ((If) callNodes[0]).getTest();
            if (testObject instanceof Call) {
                Call test = (Call) testObject;
                PyObject functionObject = test.getFunc();
                if (functionObject instanceof Name) {
                    Name funcName = (Name) functionObject;
                    if (funcName.getInternalId().equals("window")) {
                        expr windowNameObject = test.getInternalArgs().get(0);
                        if (windowNameObject instanceof Str) {
View Full Code Here

            return name.substring(0, name.length() - 3);
        return name;
    }

    private void defineVariable(String varname, String value) {
        PyObject builtin = interpreterEval("__builtin__");
        PyObject pyString;
        if (value == null)
            pyString = Py.None;
        else
            pyString = new PyString(value);
        builtin.__setattr__(varname, pyString);
View Full Code Here

        readTestExecutor();
        debugger = new PythonDebugger(this);
    }

    private PyObject getFixture() {
        PyObject fixture = interpreter.get("fixture");
        if (fixture == null) {
            throw new ScriptException("no fixture found for test " + filename);
        }
        return fixture;
    }
View Full Code Here

    private void readRuntime() {
        runtime = (Marathon) interpreter.get("marathon", Marathon.class);
    }

    private void readTestExecutor() {
        PyObject marathon = interpreter.get("marathon");
        PyMethod testExecutor = (PyMethod) marathon.__getattr__("execTest");
        if (testExecutor == null) {
            throw new ScriptException("no python test executor, something is wrong with the marathon runtime!");
        }
    }
View Full Code Here

    private void clearModuleDefinitions() {
        interpreterExec("import sys");
        interpreterExec("from java.awt import Color");
        PySystemState system = (PySystemState) interpreter.get("sys");
        PyStringMap modules = (PyStringMap) system.__getattr__("modules");
        PyObject builtin = modules.get(new PyString("__builtin__"));
        modules.clear();
        modules.__setitem__("__builtin__", builtin);
    }
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();
                    }
                }
            }
        });
        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

TOP

Related Classes of org.python.core.PyObject$ConversionException

Copyright © 2018 www.massapicom. 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.