SyntaxError: invalid syntax

Discussion in 'Python' started by DIBS, Dec 27, 2005.

  1. DIBS

    DIBS Guest

    I'm new to Python and I don't understand what I'm doing wrong.

    I'm running windows xp.

    In the command line window, I type:

    and I get the response"

    SyntaxError: invalid syntax

    If anyone cane help me I'd be very grateful.
    DIBS, Dec 27, 2005
    1. Advertisements

  2. Please post the *full* traceback of the error, not just the last

    For example, something like this:
    File "<stdin>", line 1
    x = x+*9
    SyntaxError: invalid syntax

    Just "SyntaxError" on its own is not enough to tell what is going on,
    except to say that it sounds like a bug in the program you are trying to
    Steven D'Aprano, Dec 27, 2005
    1. Advertisements

  3. or that he's using a program written for a newer version of Python than
    the one he has on his machine...

    Fredrik Lundh, Dec 27, 2005
  4. DIBS

    DIBS Guest

    File "<stdin>", line 1

    Thanks for your help.
    The above is the extact message.

    DIBS, Dec 27, 2005
  5. that looks like the Python interpreter window, not the Windows command-
    line window.

    To run complete Python programs, type "python filename" in the Windows
    command-line window (or double-click on filename from the explorer).

    the FAQ has more information:

    Fredrik Lundh, Dec 27, 2005
  6. Based on the ">>>" prompt, I'd say you tried to type this
    into the python interactive interpreter. It's supposed to be
    a shell command -- i.e. you *invoke* the python interpreter
    to run the file from the command line.

    If you are already running python, then you might get what
    you want by importing the module:

    but whether that's what you really want or not depends on
    how the module is meant to be used (is it a "module" or a

    Terry Hancock, Dec 27, 2005
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.