本文整理汇总了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;
}
}
示例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);
}
示例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;
}
}
示例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();
}
示例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);
}
示例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();
}
}