Package org.python.core

Examples of org.python.core.PyObject$ConversionException


    */
   public RobotStep getNextStep()
   {
      try
      {
         final PyObject function = this.currentInterpreter.get("nextStep");
         Object result = function.__call__();
         return RobotStep.valueOf(result.toString());
      }
      catch (Exception ex)
      {
         ex.printStackTrace();
View Full Code Here


   }

   private String getVariableType(String variableName)
   {
      final PythonInterpreter interp = this.getCurrentInterpreter();
      PyObject selectedObj = interp.get(variableName);
      if (selectedObj != null)

         return selectedObj.getType().toString();
      else
         return "Unknown";
   }
View Full Code Here

   }

   private String getVariableValue(String variableName)
   {
      final PythonInterpreter interp = this.getCurrentInterpreter();
      PyObject selectedObj = interp.get(variableName);
      if (selectedObj != null)

         return selectedObj.toString();
      else
         return "Unknown";
   }
View Full Code Here

   private void updateMethodsList(String selectedToken)
   {
      try
      {
         final PythonInterpreter interp = this.getCurrentInterpreter();
         PyObject obj = interp.eval("dir(" + selectedToken + ")");
         PyList pyList = (PyList) obj;
         final ScriptInfoPanel info = ScriptInfoPanel.getInstance();
         info.getListModel().clear();
         for (Object o : pyList)
         {
View Full Code Here

                if (!key.startsWith("__") && !key.equals("schemaFunction")
                        && !key.equals("outputSchema")
                        && !key.equals("outputSchemaFunction")
                        && (value instanceof PyFunction)
                        && (((PyFunction)value).__findattr__("schemaFunction")== null)) {
                    PyObject obj = ((PyFunction)value).__findattr__("outputSchema");
                    if(obj != null) {
                        Utils.getSchemaFromString(obj.toString());
                    }
                    funcspec = new FuncSpec(JythonFunction.class.getCanonicalName() + "('"
                            + path + "','" + key +"')");
                    pigContext.registerFunction(namespace + key, funcspec);
                    LOG.info("Register scripting UDF: " + namespace + key);
View Full Code Here

                        }
                    }
                }
            } catch (PyException e) {
                if (e.match(Py.SystemExit)) {
                    PyObject value = e.value;
                    if (PyException.isExceptionInstance(e.value)) {
                        value = value.__findattr__("code");
                    }
                    if (new  PyInteger(0).equals(value)) {
                        LOG.info("Script invoked sys.exit(0)");
                        return;
                    }
View Full Code Here

                    Object fileEntry = null;
                    if (value instanceof PyJavaPackage ) {
                        fileEntry = ((PyJavaPackage) value).__file__;
                    } else if (value instanceof PyObject) {
                        // resolved through the filesystem (or built-in)
                        PyObject dict = ((PyObject) value).getDict();
                        if (dict != null) {
                            fileEntry = dict.__finditem__("__file__");
                        } // else built-in
                    }   // else some system module?

                    if (fileEntry != null) {
                        File file = new File(fileEntry.toString());
View Full Code Here

        return new PythonSearchScript((PyCode) compiledScript, vars, lookup);
    }

    @Override
    public Object execute(Object compiledScript, Map<String, Object> vars) {
        PyObject pyVars = Py.java2py(vars);
        interp.setLocals(pyVars);
        PyObject ret = interp.eval((PyCode) compiledScript);
        if (ret == null) {
            return null;
        }
        return ret.__tojava__(Object.class);
    }
View Full Code Here

        }

        @Override
        public Object run() {
            interp.setLocals(pyVars);
            PyObject ret = interp.eval(code);
            if (ret == null) {
                return null;
            }
            return ret.__tojava__(Object.class);
        }
View Full Code Here

        }

        @Override
        public Object run() {
            interp.setLocals(pyVars);
            PyObject ret = interp.eval(code);
            if (ret == null) {
                return null;
            }
            return ret.__tojava__(Object.class);
        }
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.