我试图在python文件中的defm(input)中插入“helloworld”。但它不起作用我怎么能解决这个问题
main.py
def m(input):
return input
MainActivity.java
if(!Python.isStarted())
Python.start(new AndroidPlatform(this));
Python py = Python.getInstance();
PyObject pyf = py.getModule("main");
PyObject obj = pyf.callAttr("m('Hello World')");
text.setText(obj.toString());
这就是我犯的错误
com.chaquo.python.PyException: AttributeError: module 'main' has no attribute 'm('Hello World')'
callAttr
的参数应该单独传递,而不是作为单个Python表达式传递。例如:有关更多信息,请参见^{} documentation 和examples
相关问题 更多 >
编程相关推荐