• Как исправить ошибку программы погода?

    @newmaroluctwin
    Правильный код:
    import eel
    import pyowm
    
    
    owm = pyowm.OWM("*****ваш код*****")
    
    @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 "It is now " + str(temp) + "°" + " in " + place
    
    
    eel.init("web")
    eel.start("main.html", size=(700, 700))


    <!DOCTYPE html>
    <html>
    <head>
    	<meta charset="UTF-8">
    	<title>Weatherice</title>
    
    	<script src="eel.js"></script>
    	<link rel="icon" type="image/png" href="/images/favicon.png">
    
    	<link rel="stylesheet" href="main.css">
    	<link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap" rel="stylesheet">
    </head>
    <body>
    
    	<input id="location" type="text", placeholder="Enter the name of the country and city..." required="" value="New York, USA">
    
    	<button id="show">Find out the weather</button>
    
        <hr noshade color="white" size="2">
    
    	<div id="info"></div>
    
    	<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
    	<script type="text/javascript">
    		// JS code for Python functions
    
    		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>


    * {
    	font-family: "Roboto", sans-serif;
    	box-sizing: border-box;
    	font-weight: 300;
    }
    
    body {
    	background: #01b7a2; /* fallback for old browsers*/
    	background: -webkit-linear-gradient(to right, #02a1b0, #00cd96); /* Chrome 10-25, Safari */
    	background: linear-gradient(to right, #02a1b0, #00cd96); /* W3C, IE 10+/ Edge, Firefox */
    
    	color: white;
    	padding: 50px;
    }
    
    #location {
    	display: block;
    	border: none;
    	background: rgba(255, 255, 255, 0.5);
    	border-radius: 10px;
    	padding: 20px;
    	color: white;
    	outline: none;
    	width: 100%;
    	font-size: 30px;
    }
    
    #location:placeholder {
    	color: rgba(255, 255, 255, 0.5);
    }
    
    #show {
    	display: block;
    	border: none;
    	margin-top: 15px;
    
    	background: #ffb9af; /* fallback for old browsers*/
    	background: -webkit-linear-gradient(to right, #ffc3a0, #ffafbd); /* Chrome 10-25, Safari */
    	background: linear-gradient(to right, #ffc3a0, #ffafbd); /* W3C, IE 10+/ Edge, Firefox */
    
    	border-radius: 10px;
    	padding: 20px;
    	color: white;
    	outline: none;
    	width: 100%;
    	font-size: 20px;
    	text-transform: uppercase;
    	font-weight: bold;
    	cursor: pointer;
    }
    
    #show:hover {
    	opacity: .9;
    }
    
    hr {
        margin-top: 15px;
        margin-bottom: 15px;
        opacity: .5;
    }


    6172f9828bd60789436068.jpeg
    6172f99223e33398528827.jpeg
    6172f99e60d00065971543.jpeg
    Ответ написан
    Комментировать