我需要将java字符串值(pdf文件的路径)传递给Jython解释器中的函数,即os.startfile(filename, "print")
(其中filename是字符串)。所以我试着这样写:
import org.python.util.PythonInterpreter;
PythonInterpreter interpreter = new PythonInterpreter();
interpreter.set("filename", fileDaStampare);
interpreter.exec("import os");
interpreter.exec("os.startfile(filename, \"print\")");
但当我执行java程序时,它会返回这个错误:
console: Failed to install '': java.nio.charset.UnsupportedCharsetException: cp0. Traceback (most recent call last): File "", line 1, in AttributeError: 'module' object has no attribute 'startfile'
在Python解释器中如何执行这段代码?你知道吗
目前没有回答
相关问题 更多 >
编程相关推荐