New to Python-- Help

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John & Mary Cook

    #1

    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 "<interacti ve input>", line 1, in ?
    Name Error: name 'python' is not defined

    Can anyone help?

    Thank you,

    J. T. Cook


  • Philippe Martin

    #2
    Re: New to Python-- Help

    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 "<interacti ve 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

    Comment

    • Jason

      #3
      Re: New to Python-- Help

      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 "<interacti ve 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!') )

      Comment

      • akameswaran@gmail.com

        #4
        Re: New to Python-- Help

        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 "<interacti ve input>", line 1, in ?
        Name Error: name 'python' is not defined
        >
        Can anyone help?
        >
        Thank you,
        >
        J. T. Cook

        Comment

        • Ravi Teja

          #5
          Re: New to Python-- Help


          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 "<interacti ve 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.


          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.

          Comment

          Working...