471,596 Members | 875 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,596 software developers and data experts.

New to Python-- Help

I just installed Python on Windows XP Pro. When I enter 'python' at the >>>
prompt in Pythonwin IDE I get the following:

Traceback (most recent call last):
File "<interactive input>", line 1, in ?
Name Error: name 'python' is not defined

Can anyone help?

Thank you,

J. T. Cook
Aug 8 '06 #1
4 1403
John & Mary Cook wrote:
I just installed Python on Windows XP Pro. When I enter 'python' at the
>prompt in Pythonwin IDE I get the following:

Traceback (most recent call last):
File "<interactive input>", line 1, in ?
Name Error: name 'python' is not defined

Can anyone help?

Thank you,

J. T. Cook
Did you install Python, or Pythonwin ?

Cannot use #2 without #1.

Philippe

Aug 8 '06 #2
John & Mary Cook wrote:
I just installed Python on Windows XP Pro. When I enter 'python' at the >>>
prompt in Pythonwin IDE I get the following:

Traceback (most recent call last):
File "<interactive input>", line 1, in ?
Name Error: name 'python' is not defined

Can anyone help?

Thank you,

J. T. Cook
That's because the Pythonwin IDE with the >>prompt is already running
the Python interpreter. The Python interpreter allows you to run
python statements and expressions with instant feedback.

Python doesn't define the 'python' name inside of itself.

I recommend that you read through the Python tutorial, and maybe do a
Google search for Python tutorials.

When you next see the >>prompt, try typing in the following:
import this
print ' '.join( ('Python', 'rocks!') )

Aug 8 '06 #3
Are you refering to IDLE? or simply running python at the command
line?

In either case - python is just the language's name. It is not a
defined name within the language.

If you describe what you are trying to do, perhaps some more specific
help could be had.

What is happening:
There currently is no name in the interpreter called python and it is
telling you that

Try this.
>>python = "A cool language"
python
'A cool language'
>>dir()
['__builtins__', '__doc__', '__name__', 'python']
>>>
btw: dir() is a way of getting the currently defined names
you could also try this - just to get a feel for the names

you can also request the names going down the heirarchy.

enter:
dir(__doc__)
and see what happens.

Happy Pythoning.

John & Mary Cook wrote:
I just installed Python on Windows XP Pro. When I enter 'python' at the >>>
prompt in Pythonwin IDE I get the following:

Traceback (most recent call last):
File "<interactive input>", line 1, in ?
Name Error: name 'python' is not defined

Can anyone help?

Thank you,

J. T. Cook
Aug 8 '06 #4

Philippe Martin wrote:
John & Mary Cook wrote:
I just installed Python on Windows XP Pro. When I enter 'python' at the
>>prompt in Pythonwin IDE I get the following:
Traceback (most recent call last):
File "<interactive input>", line 1, in ?
Name Error: name 'python' is not defined

Can anyone help?

Thank you,

J. T. Cook

Did you install Python, or Pythonwin ?

Cannot use #2 without #1.
He probably used ActivePython. It includes both. Besides PythonWin IDE
won't start without Python :-)

John:
Try this tutorial. It does not assume a programming background.
http://honors.montana.edu/~jjc/easytut/easytut/

You already started Python when you started PythonWin IDE. You won't
need to type python in it again :-)

In the tutorial I linked, PythonWin is analogous to IDLE (another IDE)
mentioned in it. You should also have IDLE installed in your menus.

Aug 8 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

32 posts views Thread by Sticks | last post: by
reply views Thread by python-help-bounces | last post: by
reply views Thread by python-help-bounces | last post: by
1 post views Thread by Matt Upton | last post: by
reply views Thread by Leeds, Mark | last post: by
2 posts views Thread by Scott Smith | last post: by
1 post views Thread by Lad | last post: by
4 posts views Thread by mlimber | last post: by
reply views Thread by Anwar ali | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.