Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #22405

Re: help needed to understand an error message.

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!xlned.com!feeder7.xlned.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <jcd@sdf.lonestar.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.004
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'subject:error': 0.03; '[2]:': 0.09; 'literal': 0.09; 'parser': 0.09; 'referencing': 0.09; 'python': 0.11; 'print': 0.15; '*you*': 0.16; 'cliff': 0.16; 'received:192.168.11': 0.16; 'syntaxerror:': 0.16; 'x-mailer:evolution 2.32.3': 0.16; 'do.': 0.16; 'meant': 0.16; 'subject:help': 0.17; 'error:': 0.18; 'exercise': 0.18; 'typing': 0.18; 'mon,': 0.18; 'string': 0.18; 'trying': 0.20; 'programming': 0.21; 'wrote:': 0.21; 'indicated': 0.22; 'header:In-Reply-To:1': 0.22; 'syntax': 0.23; 'error': 0.25; 'this.': 0.28; 'cheers,': 0.28; 'assumes': 0.29; 'thinks': 0.29; 'file': 0.29; "doesn't": 0.30; 'hi,': 0.33; 'problem': 0.34; 'url:org': 0.36; 'next': 0.38; 'received:org': 0.38; 'received:192': 0.39; "can't": 0.39; 'to:addr:python-list': 0.39; 'think': 0.40; 'received:192.168': 0.40; 'to:addr:python.org': 0.40; 'your': 0.60; 'learning': 0.61; 'however': 0.62; 'capital': 0.69; 'discovers': 0.84; 'legal.': 0.84; 'subject:message.': 0.84; 'mistake': 0.91; 'received:(may be forged)': 0.91
Subject Re: help needed to understand an error message.
From "J. Cliff Dyer" <jcd@sdf.lonestar.org>
To python-list@python.org
In-Reply-To <CABWU=QkG9riG9-1Cfhe2xoC0jjsw-Xp9S8QUCLBmRN482g2nwA@mail.gmail.com>
References <CABWU=Q=vTsjb=DU7kcB71QQ4miSnyapt+_ExeE0Qx094mdK_7w@mail.gmail.com> <CABWU=QkG9riG9-1Cfhe2xoC0jjsw-Xp9S8QUCLBmRN482g2nwA@mail.gmail.com>
Content-Type text/plain; charset="UTF-8"
Date Fri, 30 Mar 2012 21:51:42 -0400
Mime-Version 1.0
X-Mailer Evolution 2.32.3
Content-Transfer-Encoding 7bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.12
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1165.1333158726.3037.python-list@python.org> (permalink)
Lines 48
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1333158726 news.xs4all.nl 6855 [2001:888:2000:d::a6]:46147
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:22405

Show key headers only | View raw


So the problem is that python doesn't know what you're trying to do.  It
doesn't know that you meant to say "print."  When the parser is looking
at the word Print, it assumes you are referencing an object named Print,
which is completely legal.  It's only once you've created the next
token, a string literal, that the parser discovers the error: you can't
have a string literal following a variable.  

*You* think your error is that you misspelled "print."  The parser
thinks your error is trying to put a string literal next to a variable.

Cheers,
Cliff


On Mon, 2012-03-26 at 18:22 +0530, Aloke Ghosh wrote:
> Hi,
> I am learning Python and do not have programming experience.
> I was following
> an exercise from http://learnpythonthehardway.org/book/ex2.html
> and made a mistake in entry :
> 
> 
> Print"I like typing this." 
> 
> 
> and got the following error message:
> 
> 
> In [2]: Print"I like typing this."
> ------------------------------------------------------------
>    File "<ipython console>", line 1
>      Print"I like typing this."
>                                         ^
> SyntaxError: invalid syntax
> 
> 
> I feel the error is in Capital P in print .
> However the error indicated with "^" 
> hints at quote at the end of the line.
> 
> 
> Can any one please help me understand this.
> 
> 
> -- 
> A.K.Ghosh

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: help needed to understand an error message. "J. Cliff Dyer" <jcd@sdf.lonestar.org> - 2012-03-30 21:51 -0400

csiph-web