fedchenkoofficial
?>

Здравствуйте! Пиши программу на Python (приложение показывает погоду Столкнулся с проблемой Traceback (most recent call last): File "main.py", line 7, in owm = pyowm.owm("cc6450a19ebb3ea19e68638e02961a54") TypeError: 'module' object is not callable Вот код: import eel import pyowm city = "Россия, Тюмень" owm = pyowm.owm("cc6450a19ebb3ea19e68638e02961a54") mgr = owm.weather_manager() observation = mgr.weather_at_place(city) w = observation.weather temp = w.temperature('celsius')['temp'] print("В Городе " +city + "сейчас" + str(temp)+ "градусов!") eel.init("web") # EEL initialization @eel.expose def binary(number): """This function converts the entered number from the decimal system to binary""" return bin(int(number)).replace("0b", "") eel.start("main.html", size=(700, 400)) # Starting the App

Информатика

Ответы

varvara82193

pyowm.owm - какой-то подмодуль в модуле pyowm. Вам же нужен pyowm.OWM.

Заодно поправлю пробелы в выводе (хотя можно передать и просто в вывод через запятую - питон автоматически будет разделять их одним пробелом)

Код (Python 3):

import eel

import pyowm

city = "Россия, Тюмень"

owm = pyowm.OWM("cc6450a19ebb3ea19e68638e02961a54")

mgr = owm.weather_manager()

observation = mgr.weather_at_place(city)

w = observation.weather

temp = w.temperature('celsius')['temp']

print("В Городе " +city + " сейчас " + str(temp)+ " градусов!")

eel.init("web") # EEL initialization

@eel.expose

def binary(number):

   """This function converts the entered number from the decimal system to binary"""

   return bin(int(number)).replace("0b", "")

eel.start("main.html", size=(700, 400)) # Starting the App

Вывод:

В Городе Россия, Тюмень сейчас -12.49 градусов!

Ответить на вопрос

Поделитесь своими знаниями, ответьте на вопрос:

Здравствуйте! Пиши программу на Python (приложение показывает погоду Столкнулся с проблемой Traceback (most recent call last): File "main.py", line 7, in owm = pyowm.owm("cc6450a19ebb3ea19e68638e02961a54") TypeError: 'module' object is not callable Вот код: import eel import pyowm city = "Россия, Тюмень" owm = pyowm.owm("cc6450a19ebb3ea19e68638e02961a54") mgr = owm.weather_manager() observation = mgr.weather_at_place(city) w = observation.weather temp = w.temperature('celsius')['temp'] print("В Городе " +city + "сейчас" + str(temp)+ "градусов!") eel.init("web") # EEL initialization @eel.expose def binary(number): """This function converts the entered number from the decimal system to binary""" return bin(int(number)).replace("0b", "") eel.start("main.html", size=(700, 400)) # Starting the App
Ваше имя (никнейм)*
Email*
Комментарий*

Популярные вопросы в разделе

Камочкин
Kozloff-ra20146795
alenkadon6
director3
paninsv
dakimov
Tatyana-Sergeevna108
Баранов955
dentinnsmr467
alexey
kris5009646
kovalenko262
turovskaya69
abrolchik8511
silviya