We help IT Professionals succeed at work.
Get Started

Why its dont work?

266 Views
Last Modified: 2018-10-27
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.


Thanks!!!
untitled.py
Comment
Watch Question
CERTIFIED EXPERT
Commented:
This problem has been solved!
Unlock 1 Answer and 3 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE