C
C
ckirtuny2021-10-05 18:52:31
Python
ckirtuny, 2021-10-05 18:52:31

How to solve PyOWM 3.2.0 output issue?

Now there is a small problem:

Traceback (most recent call last):
File "C:\Python\My Own Projects\hernuia\test_var1.py", line 12, in
print("In the city " + observation + " now " + w. get_detailed_status())
TypeError: can only concatenate str (not "Observation") to str

PS Code:

import pyowm

owm = pyowm.OWM("a69f2b4e45869e5efa459f47b2389c69") # <- API Key
mgr = owm.weather_manager()

observation = mgr.weather_at_place ('London,GB')
w = observation.weather

observation.weather
observation.weather.temperature('celsius')['temp']

print("In the city " + observation + " now " + w.get_detailed_status())
print("Temperature >> " + str(temp))

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey Gornostaev, 2021-10-05
@ckirtuny

The observation variable contains an instance of the Observation class and cannot be added to the string.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question