Fedora Linux Support Community & Resources Center
  #1  
Old 4th August 2012, 08:21 AM
JamesNZ Offline
Registered User
 
Join Date: Aug 2010
Location: Wellington, New Zealand
Posts: 915
linuxchrome
Python syntax problems

Hi everyone,
So ATM I'm learning python using this wikibook. The problems start when I get to here. When I run the 'Who goes there' program in IDLE I get:
Code:
Who goes there? james

Traceback (most recent call last):
  File "/home/james/TIOBE8/learned.py", line 1, in <module>
    user = input('Who goes there? ')
  File "<string>", line 1, in <module>
NameError: name 'james' is not defined
>>>
And when I run the next program on assignment I get:
Code:
Type in a number: 12.3
Type in an integer: 123
Type in a string: hello

Traceback (most recent call last):
  File "/home/james/TIOBE8/learned.py", line 3, in <module>
    text = input("Type in a string: ")
  File "<string>", line 1, in <module>
NameError: name 'hello' is not defined
>>>
Weird thing is, I distinctly remember doing this program and many others about a year ago, and they worked perfectly Have I missed some syntax changes since then??

(P.S, and before you ask, I have RTFM. And googled it.)
__________________
"For what is a man profited if he gains the whole world, but loses his own soul?"

- Jesus
Reply With Quote
  #2  
Old 4th August 2012, 08:31 AM
RupertPupkin Offline
Registered User
 
Join Date: Nov 2006
Location: Detroit
Posts: 5,682
linuxfedorafirefox
Re: Python syntax problems

The problem is you're trying to use Python 3.x syntax in the Python 2.x version of Idle. You need to install the python3-tools package via yum, then run idle3.
__________________
OS: Fedora 20 x86_64 | Machine: HP Pavilion a6130n | CPU: AMD 64 X2 Dual-Core 5000+ 2.6GHz | RAM: 5GB PC5300 DDR2 | Disk: 400GB SATA | Video: ATI Radeon HD 4350 512MB | Sound: Realtek ALC888S | Ethernet: Realtek RTL8201N
Reply With Quote
  #3  
Old 4th August 2012, 08:52 AM
JamesNZ Offline
Registered User
 
Join Date: Aug 2010
Location: Wellington, New Zealand
Posts: 915
linuxchrome
Re: Python syntax problems

Quote:
Originally Posted by RupertPupkin View Post
The problem is you're trying to use Python 3.x syntax in the Python 2.x version of Idle. You need to install the python3-tools package via yum, then run idle3.
Whoops Thanks Rupert it works now
__________________
"For what is a man profited if he gains the whole world, but loses his own soul?"

- Jesus
Reply With Quote
Reply

Tags
problems, python, syntax

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Fedora 16 'python' syntax error BrandonAdam Using Fedora 3 22nd March 2012 10:49 PM
Problems with python-indicate mythcat Using Fedora 0 2nd June 2009 08:01 AM
Yum + Python syntax error DarkMasterHalo Using Fedora 10 12th September 2008 02:46 PM
Python problems marcos Using Fedora 1 16th September 2005 03:52 AM
Python problems!!! otherside Using Fedora 1 30th August 2005 08:16 PM


Current GMT-time: 18:24 (Tuesday, 21-10-2014)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat
Lyskovo Travel Photos on Instagram - Gurpinar Travel Photos - Farum