问题描述
import eel,urllib.request
@eel.expose
def python_function():
response = urllib.request.urlopen('http://google.com').read()
return(response)
eel.init('web')
eel.start('index.html',port=0)
现在,当我从JavaScript用
调用它时async function jsFunction() {
let result = await eel.python_function()();
return result;
}
我总是得到null
。当我从Python调用print(python_function())
时,得到了预期的HTML字符串。
在测试时,JavaScript在到达URL之前返回null。我以为Python阻止了代码。我需要重新实现一个块吗?从python_function
返回一个字符串将在jsFunction
中获得实际的字符串。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)