Answer the question
In order to leave comments, you need to log in
HTML does not see the function call from Python. Why?
On the advice of soremix - thanks to him - I fixed some bugs in the developer tools. But I faced such error.
async function display_weather() {
url: "~/main.py";
let place = document.getElementById('location').value;
let res = await eel.get_weather(place)();
document.getElementById('info').innetHTML = res;
}
jQuery('#show').on('click', function() {
display_weather();
});
import eel
import pyowm
eel.init("web")
eel.start("main.html", size=(1000, 800))
owm = pyowm.OWM("87c22185adb4fbaf72d55722562bc9ca")
@eel.expose
def get_weather(place):
mgr = owm.weather_manager()
observation = mgr.weather_at_place(place)
w = observation.weather
temp = w.temperature('celsius')['temp']
return "В городе " + place + " сейчас " + str(temp) + " градусов!"
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question