Why its dont work?

Hello! I am a python beginner. I write a code, with pyowm module (Pyowm on github: https://github.com/csparpa/pyowm), but its for some reason wrong. I has download the pyowm module and I using the terminal for module installation on python 3. My os is Mac OS X Yosemite and the my python version is 3.6.3. I even use Sublime Text 3 as a code editor. What I do wrong? Please help me!
My code:
    import pyowm
    city = input('Write a city for weather analysis:')
    owm = pyowm.OWM('5f28df836a35fc458e6270eb8f01ec86')
    observation = own.weather_at_place(city)
    w = observation.get_weather()
    temperature = w.get_temperature('celsius')['temp']
    print("The temperature in" + city + "is: " + str(temperature) + "on celsius")

But python say:

Traceback (most recent call last):
  File "untitled.py", line 3, in <module>
    city = input('Write a city for weather analysis:')
  File "<string>", line 1, in <module>
NameError: name 'London' is not defined
SBSC02PBB8G9402:pythonpractice dchim$ python untitled.py
Write a city for weather analysis: London
Traceback (most recent call last):
  File "untitled.py", line 3, in <module>
    city = input(str('Write a city for weather analysis:'))
  File "<string>", line 1, in <module>
NameError: name 'London' is not defined.

Ari AbdrakhmanovAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Fermi ParadoxPhysicistCommented:
Are you sure you are using python 3? Try inserting:

import sys

Open in new window

at the top of the module. What does it print?
I tried and I can confirm what Fermi Paradox suggested. You have launched the script using Python 2. If you want to use Python 2, you have to change the input to the equivalent raw_input. The input in Python 2 reads the string from the input and calls eval to interpret the string. You did type London, and it tries to use the object of that name -- this is the reason why the error is displayed.

So, you want to use Python 3. Fix also your line with observation = ovn... to owm. If you need to use Python 2, try the following:
from __future__ import print_function
import pyowm

city = raw_input('Write a city for weather analysis: ')

owm = pyowm.OWM('5f28df836a35fc458e6270eb8f01ec86')
observation = owm.weather_at_place(city)
w = observation.get_weather()
temperature = w.get_temperature('celsius')['temp']

print('The temperature in', city, 'is:', temperature, 'on celsius')

Open in new window

In the later case, you need pip install pyown also for Python 2.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Suhas .Senior QA ManagerCommented:
No comment has been added to this question in more than 21 days, so it is now classified as abandoned.

I have recommended this question be closed as follows:

Accept: pepr (https:#a42356067)

If you feel this question should be closed differently, post an objection and the moderators will review all objections and close it as they feel fit. If no one objects, this question will be closed automatically the way described above.

Experts-Exchange Cleanup Volunteer
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Operating Systems

From novice to tech pro — start learning today.