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:
    Python Sudoku.py

    and I get the response"

    SyntaxError: invalid syntax

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

  2. On Tue, 27 Dec 2005 07:40:12 +0000, DIBS wrote:

    > 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:
    > Python Sudoku.py
    >
    > and I get the response"
    >
    > SyntaxError: invalid syntax
    >
    > If anyone cane help me I'd be very grateful.


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

    For example, something like this:

    >>> x = x+*9

    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
    run.


    --
    Steven.
    Steven D'Aprano, Dec 27, 2005
    #2
    1. Advertising

  3. Steven D'Aprano wrote:

    > Please post the *full* traceback of the error, not just the last
    > description.
    >
    > For example, something like this:
    >
    > >>> x = x+*9

    > 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
    > run.


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

    </F>
    Fredrik Lundh, Dec 27, 2005
    #3
  4. DIBS

    DIBS Guest

    >>> python sudoku.py
    File "<stdin>", line 1
    python sudoku.py
    ^

    >>>SyntaxError: invalid syntax





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

    DIBS




    "Steven D'Aprano" <> wrote in message
    news:p...
    > On Tue, 27 Dec 2005 07:40:12 +0000, DIBS wrote:
    >
    >> 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:
    >> Python Sudoku.py
    >>
    >> and I get the response"
    >>
    >> SyntaxError: invalid syntax
    >>
    >> If anyone cane help me I'd be very grateful.

    >
    > Please post the *full* traceback of the error, not just the last
    > description.
    >
    > For example, something like this:
    >
    >>>> x = x+*9

    > 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
    > run.
    >
    >
    > --
    > Steven.
    >
    DIBS, Dec 27, 2005
    #4
  5. "DIBS" <> wrote:

    > >>> python sudoku.py

    > File "<stdin>", line 1
    > python sudoku.py
    > ^
    >
    > >>>SyntaxError: invalid syntax


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


    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:

    http://www.python.org/doc/faq/windows.html#how-do-i-run-a-python-program-under-windows

    </F>
    Fredrik Lundh, Dec 27, 2005
    #5
  6. On Tue, 27 Dec 2005 09:32:18 GMT
    "DIBS" <> wrote:
    > >>> python sudoku.py

    > File "<stdin>", line 1
    > python sudoku.py
    > ^
    >
    > >>>SyntaxError: invalid syntax

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


    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:

    >>> import sudoku


    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
    "script"?).

    Cheers,
    Terry

    --
    Terry Hancock ()
    Anansi Spaceworks http://www.AnansiSpaceworks.com
    Terry Hancock, Dec 27, 2005
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. ronrsr

    SyntaxError: Invalid Syntax.

    ronrsr, Nov 10, 2006, in forum: Python
    Replies:
    10
    Views:
    1,358
    John Machin
    Nov 10, 2006
  2. Replies:
    3
    Views:
    1,641
  3. Python Newsgroup

    SyntaxError: invalid syntax (windows)

    Python Newsgroup, Mar 25, 2009, in forum: Python
    Replies:
    6
    Views:
    1,241
    Terry Reedy
    Mar 25, 2009
  4. nicklancer

    SyntaxError: invalid syntax

    nicklancer, Apr 26, 2011, in forum: Python
    Replies:
    0
    Views:
    592
    nicklancer
    Apr 26, 2011
  5. Replies:
    9
    Views:
    333
    Karim
    Jan 10, 2013
Loading...

Share This Page