如何解决我正在学习python和JS试图编写应用程序显示天气但是我收到错误消息无法加载资源:net :: ERR_FILE_NOT_FOUND
错误类型:
Failed to load resource: net::ERR_FILE_NOT_FOUND
main.html:27 Uncaught (in promise) ReferenceError: eel is not defined
at display_weather (main.html:27)
at HTMLButtonElement.<anonymous> (main.html:32)
at HTMLButtonElement.dispatch (jquery.min.js:2)
at HTMLButtonElement.v.handle (jquery.min.js:2)
我已经尝试了很多方法来解决问题,但是我不能。鳗鱼有问题,已经安装了教程中显示的鳗鱼。这是带有html和js的文件
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Weather by Alibek</title>
<script type="text/javascript" src="/eel.js"></script>
<link rel="stylesheet" type="image/png" href="weather-icon.png">
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<input id="location" type="text" placeholder="Write the name of your Country ot City" required="" value="Bukhara,Uzbekistan">
<button id ="show">Know the weather</button>
<div id="info ">
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script type="text/javascript">
async function display_weather(){
let place = document.getElementById('location').value;
let res = await eel.get_weather(place)();
document.getElementById('info').innerHTML = res;
}
jQuery('#show').on('click',function(){
display_weather();
});
</script>
</body>
</html>
这是python代码:
import eel
import pyowm
own = pyowm.OWM('d845c8640738fe82515cb1277bb3dd38')
@eel.expose
def get_weather(place):
mgr = own.weather_manager()
observation = mgr.weather_at_place(city)
w = observation.weather
temp = w.temperature('celsius')['temp']
return city + ' ' + str(temp)
#eel.init('web')
#eel.start('index.html',size=(700,700))
有人说我必须将鳗鱼文件与这些文件一起上传,但是我应该在哪里获得该文件?他们中的一些人说我应该下载它,但是我已经通过cmd下载了它。顺便说一下,我使用Linux Mint20。谢谢
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。