当前位置: 首页>>代码示例>>Java>>正文


Java PyException.printStackTrace方法代码示例

本文整理汇总了Java中org.python.core.PyException.printStackTrace方法的典型用法代码示例。如果您正苦于以下问题:Java PyException.printStackTrace方法的具体用法?Java PyException.printStackTrace怎么用?Java PyException.printStackTrace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.python.core.PyException的用法示例。


在下文中一共展示了PyException.printStackTrace方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: callFunc

import org.python.core.PyException; //导入方法依赖的package包/类
public static Object callFunc(Class<?> c, String funcName, Object... binds) {
	try {
		PyObject obj = ScriptManager.python.get(funcName);
		if (obj != null && obj instanceof PyFunction) {
			PyFunction func = (PyFunction) obj;
			PyObject[] objects = new PyObject[binds.length];
			for (int i = 0; i < binds.length; i++) {
				Object bind = binds[i];
				objects[i] = Py.java2py(bind);
			}
			return func.__call__(objects).__tojava__(c);
		} else
			return null;
	} catch (PyException ex) {
		ex.printStackTrace();
		return null;
	}
}
 
开发者ID:Jarinus,项目名称:osrs-private-server,代码行数:19,代码来源:ScriptManager.java

示例2: executeCommand

import org.python.core.PyException; //导入方法依赖的package包/类
public void executeCommand(String commands) {

        StringBuilder text;

        moreCommand += commands;

        try {           
            // If command is not finished (i.e. loop)
            if(interp.runsource(moreCommand)) {
                text = new StringBuilder(getText()); 
                text.append(ps2);
                moreCommand += "\n";
            } else {
                text = new StringBuilder(getText()); 
                text.append(ps1);
                moreCommand = "";
            }

            setText(text.toString());
        } catch (PyException e) {
            e.printStackTrace();
        }
        fireCommandExecuted(commands);
    }
 
开发者ID:opensim-org,项目名称:opensim-gui,代码行数:25,代码来源:JConsole.java

示例3: getVariable

import org.python.core.PyException; //导入方法依赖的package包/类
public static PyObject getVariable(String variable) {
	try {
		return ScriptManager.python.get(variable);
	} catch (PyException e) {
		e.printStackTrace();
		return null;
	}
}
 
开发者ID:Jarinus,项目名称:osrs-private-server,代码行数:9,代码来源:ScriptManager.java

示例4: perform

import org.python.core.PyException; //导入方法依赖的package包/类
@Override
  public void perform() throws Failure
  {
  	// The delegate interface is carefully designed to keep the API public,
  	//  but keep the knowledge of ModelRoot, Selection, and ChangeConstructions, etc. here.
  	
  	Command.Delegate delegate = this .createDelegate();
  	
  	Properties props = new Properties();
  	props .setProperty( "python.path", "/Library/Python/2.7/site-packages" );
  	
  	// TODO this could be done once, when the python console is opened
      InteractiveConsole.initialize( System.getProperties(), props, new String[0] );
      
      PythonInterpreter interp = new PythonInterpreter();
      interp .setOut( System.out );
      interp .setErr( System.err );
      interp .set( "javaCommand", new Command( delegate ) );
      try {
	interp .exec( "import vzome" );
	interp .exec( "command = vzome.Command( cmd=javaCommand )" );
	interp .exec( this .programText );
} catch ( PyException e ) {
	e.printStackTrace();
	throw new Failure( e.toString() );
}
      redo();
  }
 
开发者ID:vZome,项目名称:vzome-core,代码行数:29,代码来源:RunPythonScript.java

示例5: executeFile

import org.python.core.PyException; //导入方法依赖的package包/类
public void executeFile(String filename) {
    try {
        interp.execfile(filename);
    } catch (PyException e) {
        e.printStackTrace();
    }                    
  
    fireCommandExecuted(getFileContents(filename));
    fireCommandExecuted("Finished executing script file " + filename);

}
 
开发者ID:opensim-org,项目名称:opensim-gui,代码行数:12,代码来源:JConsole.java

示例6: getMessage

import org.python.core.PyException; //导入方法依赖的package包/类
/**
 * Gets message of a PyException.
 * If internal message is null, uses printStackTrace() method to build message.
 *
 * @param e PyException
 * @return message string
 */
public static String getMessage(PyException e) {
    if (e.getMessage() != null) {
        return e.getMessage();
    } else {
        StringWriter stringWriter = new StringWriter();
        e.printStackTrace(new PrintWriter(stringWriter));
        return stringWriter.toString();
    }
}
 
开发者ID:qspin,项目名称:qtaste,代码行数:17,代码来源:PythonHelper.java


注:本文中的org.python.core.PyException.printStackTrace方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。