Re: Syntax Error

Discussion in 'Python' started by Steven D'Aprano, Mar 19, 2011.

  1. On Fri, 18 Mar 2011 21:39:20 -0700, Manatee wrote:

    > I hope this is the place to post this question. I am a really new
    > pythonista. I am studying Tkinter and when I run this basic code, I get
    > a syntax error on line 20, print "hi there, everyone". Its a simple
    > print line, but I can't see the problem.


    Well, what does the syntax error say? Please post the complete traceback
    showing the full error. Copy and paste it, in full, do not summarize,
    paraphrase, re-word, simplify or otherwise change it.


    --
    Steven
     
    Steven D'Aprano, Mar 19, 2011
    #1
    1. Advertising

  2. Steven D'Aprano

    Manatee Guest

    On Mar 19, 3:26 am, Steven D'Aprano <steve
    > wrote:
    > On Fri, 18 Mar 2011 21:39:20 -0700, Manatee wrote:
    > > I hope this is the place to post this question. I am a really new
    > > pythonista. I am studying Tkinter and when I run this basic code, I get
    > > a syntax error on line 20,  print "hi there, everyone". Its a simple
    > > print line, but I can't see the problem.

    >
    > Well, what does the syntax error say? Please post the complete traceback
    > showing the full error. Copy and paste it, in full, do not summarize,
    > paraphrase, re-word, simplify or otherwise change it.
    >
    > --
    > Steven



    Here is the complete traceback as copied from the DOS window.

    C:\Users\Rivetmr\MyPythonScripts>Hello2.py
    File "C:\Users\Rivetmr\MyPythonScripts\Hello2.py", line 20
    print "hi there, everyone"
    ^
    SyntaxError: invalid syntax
     
    Manatee, Mar 19, 2011
    #2
    1. Advertising

  3. Steven D'Aprano

    Manatee Guest

    On Mar 19, 3:26 am, Steven D'Aprano <steve
    > wrote:
    > On Fri, 18 Mar 2011 21:39:20 -0700, Manatee wrote:
    > > I hope this is the place to post this question. I am a really new

    >


    Also, this is what is printed in the window when I type "Python"

    C:\Users\Rivetmr\MyPythonScripts>Python
    Python 2.7.1 (r271:86832, Nov 27 2010, 17:19:03) [MSC v.1500 64 bit
    (AMD64)] onI
    win32
    Type "help", "copyright", "credits" or "license" for more information.
    >>>



    I guess I have to go to an earlier version; maybe 2.6?
     
    Manatee, Mar 19, 2011
    #3
  4. Steven D'Aprano

    Manatee Guest

    On Mar 19, 3:26 am, Steven D'Aprano <steve
    > wrote:
    > On Fri, 18 Mar 2011 21:39:20 -0700, Manatee wrote:
    > > I hope this is the place to post this question. I am a really new
    > > pythonista. I am studying Tkinter and when I run this basic code, I get
    > > a syntax error on line 20,  print "hi there, everyone". Its a simple
    > > print line, but I can't see the problem.

    >
    > Well, what does the syntax error say? Please post the complete traceback
    > showing the full error. Copy and paste it, in full, do not summarize,
    > paraphrase, re-word, simplify or otherwise change it.
    >
    > --
    > Steven


    If I want to start up different versions of Python from the dos window
    I would actually have to be in the directory where that version lives?
    is that correct?
     
    Manatee, Mar 19, 2011
    #4
  5. Steven D'Aprano

    Terry Reedy Guest

    On 3/19/2011 2:07 PM, Manatee wrote:

    > C:\Users\Rivetmr\MyPythonScripts>Python
    > Python 2.7.1 (r271:86832, Nov 27 2010, 17:19:03) [MSC v.1500 64 bit
    > (AMD64)] onI
    > win32
    > Type "help", "copyright", "credits" or "license" for more information.
    >>>>

    >
    >
    > I guess I have to go to an earlier version; maybe 2.6?


    No reason to think that. 2.7 is not much different.
    I suggest that you comment out the print line (add # to beginning) to
    see if the syntax error is really in the print line or if there there is
    a previous error which is only caught on that line. Also try moving the
    line to a different place (and adjusting indent as necessary) to see
    what happens. Debugging is often a matter of trying different things to
    collect more bits of information. Python, especially with IDLE or other
    editor with a Run key, make that especially easy.

    --
    Terry Jan Reedy
     
    Terry Reedy, Mar 19, 2011
    #5
    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. Balaji
    Replies:
    3
    Views:
    10,142
  2. gabriele renzi
    Replies:
    2
    Views:
    221
    gabriele renzi
    Dec 31, 2005
  3. Ken Bloom
    Replies:
    3
    Views:
    224
  4. Good Night Moon
    Replies:
    9
    Views:
    294
    Rick DeNatale
    Jul 25, 2007
  5. Mark Richards
    Replies:
    3
    Views:
    324
    Tad McClellan
    Nov 18, 2007
Loading...

Share This Page