Home python I am trying to write code that will give me the weather...

I am trying to write code that will give me the weather in my city on pyowm

Author

Date

Category

There is a simple code, it was written according to the instructions from the github, but the code decided to check that it will print me errors on the entire command line

import pyowm
owm = pyowm.OWM ('myToken')
observation = owm.weather_at_place ('Kiev')
w = observation.get_weather ()
print (w)

https://github.com/csparpa/pyowm
Everything is according to the instructions

Here comes the error

I would be grateful if tell me where I blunted


Answer 1, authority 100%

I think the mistake is that I didn’t find your city https://openweathermap.org and the site reads Cyrillic then Russian language

Here’s the working code:

import pyowm
owm = pyowm.OWM ('myTokenyour_token', language = "RU")
place = input ("In which city / country ?:")
observation = owm.weather_at_place (place)
w = observation.get_weather ()
print ("In the city" + place + "now" +
w.get_detailed_status ())
temp = w.get_temperature ('celsius') ['temp']
print ('Temperature in the area:' + str (temp) + '° C')

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions