I'm learning python and JS. Tried to write the application witch shows weather. But I got error Failed to load resource: net::ERR_FILE_NOT_FOUND

Viewed 154

Type of error:

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)

I've tried a lot of stuff to solve the problem, but I can't. There is a problem with eel, already I've installed eel which has shown in tutorial.This is file with html and 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>

And here is python code:

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))

Some people say that I have to upload the eel file with these files, but where I should get that file? Some of them say I should download it, but I have already downloded it through cmd. By the way I use Linux Mint 20. Thanks

0 Answers
Related