小编Ali*_*464的帖子

JQuery with Eel:无法加载资源:net::ERR_FILE_NOT_FOUND

我正在学习Python和JS。我尝试编写一个显示天气的应用程序。但我收到了这个错误:

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)
Run Code Online (Sandbox Code Playgroud)

我已经尝试了很多东西来解决这个问题,但我不能。eel 有问题,我已经安装了教程中显示的 eel。这是带有 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 …
Run Code Online (Sandbox Code Playgroud)

html javascript python jquery

5
推荐指数
0
解决办法
210
查看次数

错误:404 Not Found 抱歉,请求的 URL 'http://localhost:8000/main.html' 导致错误:文件不存在

在此输入图像描述 Everythink 进展顺利,但是当我完成代码并尝试运行时,我收到了此错误,您认为会发生什么。我使用 Linux Mint。我认为问题出在 EEL 模块上,当我运行 html 代码并转到控制台时,我可以看到GET file:///eel.js net::ERR_FILE_NOT_FOUND 我已经解决这个问题 3-4 天了,但我找不到答案。我希望你能帮助我解决这个问题。Python代码:

import eel
import pyowm


own = pyowm.OWM('d845c8640738fe82515cb1277bb3dd38')

eel.init('web')

eel.start('main.html', size=(700, 700))

@eel.expose
def get_weather(city):

    mgr = own.weather_manager()

    observation = mgr.weather_at_place(city)
    w = observation.weather 

    temp = w.temperature('celsius')['temp']

    return city + ' ' +  str(temp)
Run Code Online (Sandbox Code Playgroud)

和 html/js 代码:

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>Weather</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 …
Run Code Online (Sandbox Code Playgroud)

html javascript python weather eel

0
推荐指数
1
解决办法
6838
查看次数

标签 统计

html ×2

javascript ×2

python ×2

eel ×1

jquery ×1

weather ×1