Re: Syntax error for simple script

2017-06-28 Thread Erik
On 28/06/17 03:46, Steve D'Aprano wrote: All of this is irrelevant if beginners don't read the error message. "if". End-users don't read error messages, no matter how well written they are, Reference? and every word you add probably cuts the number of people reading it by half. "probabl

Re: Syntax error for simple script

2017-06-28 Thread Steven D'Aprano
On Wed, 28 Jun 2017 09:51:17 +0200, Adriaan Renting wrote: > it would be nice if it was specific enough that if you put it in a > search engine you get relevant results explaining things. You mean like this? https://duckduckgo.com/?q=SyntaxError%3A+Missing+parentheses+in+call+to+%27print%27 h

Re: Syntax error for simple script

2017-06-28 Thread Adriaan Renting
Adriaan Renting| Email: rent...@astron.nl Software Engineer Radio Observatory ASTRON | Phone: +31 521 595 100 (797 direct) P.O. Box 2 | GSM: +31 6 24 25 17 28 NL-7990 AA Dwingeloo | FAX: +31 521 595 101 The Netherlands| Web: http://www.astron.nl/

Re: Syntax error for simple script

2017-06-27 Thread Chris Angelico
On Wed, Jun 28, 2017 at 12:46 PM, Steve D'Aprano wrote: > I think that there are broadly two sets of newbies in the world: > > - those who will read the message, and be able to resolve the problem from the > current wording ("oh, it needs parentheses, like a function"); > > - and those who won't,

Re: Syntax error for simple script

2017-06-27 Thread Steve D'Aprano
On Wed, 28 Jun 2017 05:38 am, Erik wrote: [...] > So I don't understand the resistance to making the error be a bit more > explicit about why it is being generated to help those users - it > doesn't explain (the obvious reason) _why_ their tutorial/example gives > them an error when it doesn't to

Re: Syntax error for simple script

2017-06-27 Thread Erik
On 27/06/17 15:05, Steve D'Aprano wrote: On Tue, 27 Jun 2017 08:34 am, Erik wrote about the print function error message: To be fair, this already seems to be a special case: [...] >>> len "bar" File "", line 1 len "bar" ^ SyntaxError: invalid syntax Correct, the pr

Re: Syntax error for simple script

2017-06-27 Thread boB Stepp
On Tue, Jun 27, 2017 at 9:05 AM, Steve D'Aprano wrote: > On Tue, 27 Jun 2017 08:34 am, Erik wrote about the print function error > message: > > py> print x > File "", line 1 > print x > ^ > SyntaxError: Missing parentheses in call to 'print' [snip] >> I think the suggestion abov

Re: Syntax error for simple script

2017-06-27 Thread Steve D'Aprano
On Tue, 27 Jun 2017 08:34 am, Erik wrote about the print function error message: py> print x File "", line 1 print x ^ SyntaxError: Missing parentheses in call to 'print' > To be fair, this already seems to be a special case: [...] > >>> len "bar" >File "", line 1 > len

Re: Syntax error for simple script

2017-06-27 Thread Steve D'Aprano
On Tue, 27 Jun 2017 03:00 am, mm0fmf wrote: > Sorry to victim blame but why can't people copy the error message into a > search engine, such as Google, and see what the problem is themselves? You're not victim blaming. There's no *victim* here, syntax errors are a part of programming and one has

Re: Syntax error for simple script

2017-06-26 Thread Steve D'Aprano
On Tue, 27 Jun 2017 09:21 am, Stefan Ram wrote: > Erik writes:Using 'print' as a >>statement is obsolete syntax in Python 3. > > »print« never was a statement. Of course it could be a statement, just like "y = x + 1" is a statement. > »print« was a keyword (2.7.6 2.3.1). It can b

Re: Syntax error for simple script

2017-06-26 Thread Rustom Mody
On Monday, June 26, 2017 at 10:11:46 PM UTC+5:30, rurpy wrote: > How about: «suggested error message» > Or better than changing the message, how about leaving it alone and > simply responding helpfully… Since everyone seems to only have read the first suggestion from rurpy, let me ask, paraphra

Re: Syntax error for simple script

2017-06-26 Thread Erik
On 27/06/17 00:21, Stefan Ram wrote: Erik writes:Using 'print' as a statement is obsolete syntax in Python 3. »print« never was a statement. »print« was a keyword (2.7.6 2.3.1). *sigh* Whatever. You have completely ignored my point (that perhaps the message could be a little

Re: Syntax error for simple script

2017-06-26 Thread Erik
On 26/06/17 18:30, Chris Angelico wrote: On Tue, Jun 27, 2017 at 2:41 AM, Rurpy via Python-list wrote: How about: In Python 2, 'print' was a statement and did not require parenthesis around its argument. In Python 3 'print' has been changed to a function and now, like all functions,

Re: Syntax error for simple script

2017-06-26 Thread Chris Angelico
On Tue, Jun 27, 2017 at 5:06 AM, Wildman via Python-list wrote: > Here it is... > > http://www.pythonforbeginners.com/code-snippets-source-code/date-and-time-script/ Since it's not world-editable, I've posted a comment. But nobody ever reads those :| I strongly recommend learning Python from a c

Re: Syntax error for simple script

2017-06-26 Thread Wildman via Python-list
On Tue, 27 Jun 2017 03:31:57 +1000, Chris Angelico wrote: > On Tue, Jun 27, 2017 at 1:16 AM, Ben S. via Python-list > wrote: >> I installed Python v3.6.1 on win 7. Afterwards I tried to execute the >> following simple python script from webpage >> http://www.pythonforbeginners.com/code-s...me-s

Re: Syntax error for simple script

2017-06-26 Thread Chris Angelico
On Tue, Jun 27, 2017 at 1:16 AM, Ben S. via Python-list wrote: > I installed Python v3.6.1 on win 7. Afterwards I tried to execute the > following simple python script from webpage > http://www.pythonforbeginners.com/code-s...me-script/: Can you provide the complete link please? Something seems

Re: Syntax error for simple script

2017-06-26 Thread Chris Angelico
On Tue, Jun 27, 2017 at 2:41 AM, Rurpy via Python-list wrote: > How about: > > In Python 2, 'print' was a statement and did not require > parenthesis around its argument. In Python 3 'print' has > been changed to a function and now, like all functions, > requires parenthesis around its ar

Re: Syntax error for simple script

2017-06-26 Thread Skip Montanaro
On Mon, Jun 26, 2017 at 11:41 AM, Rurpy via Python-list wrote: > In Python 2, 'print' was a statement and did not require > parenthesis around its argument. In Python 3 'print' has > been changed to a function I'm not sure that at this point Python 3's error messages should be polluted with

Re: Syntax error for simple script

2017-06-26 Thread mm0fmf
On 26/06/2017 17:41, ru...@yahoo.com wrote: On 06/26/2017 09:42 AM, Steve D'Aprano wrote: On Tue, 27 Jun 2017 01:16 am, Ben S. wrote: print mm + "/" + dd + "/" + + " " + hour + ":" + mi + ":" + ss ^ SyntaxError: Missing parentheses in call to 'print' Whats wrong? Did you read the error

Re: Syntax error for simple script

2017-06-26 Thread Rurpy via Python-list
On 06/26/2017 09:42 AM, Steve D'Aprano wrote: > On Tue, 27 Jun 2017 01:16 am, Ben S. wrote: > >> print mm + "/" + dd + "/" + + " " + hour + ":" + mi + ":" + ss >> ^ >> SyntaxError: Missing parentheses in call to 'print' >> >> Whats wrong? > > Did you read the error message? > > Missing

Re: Syntax error for simple script

2017-06-26 Thread Steve D'Aprano
On Tue, 27 Jun 2017 01:16 am, Ben S. wrote: > print mm + "/" + dd + "/" + + " " + hour + ":" + mi + ":" + ss > ^ > SyntaxError: Missing parentheses in call to 'print' > > Whats wrong? Did you read the error message? Missing parentheses in call to 'print' Is the message not clear enoug

Syntax error for simple script

2017-06-26 Thread Ben S. via Python-list
Sorry for this newbie question: I installed Python v3.6.1 on win 7. Afterwards I tried to execute the following simple python script from webpage http://www.pythonforbeginners.com/code-s...me-script/: Python Code: from datetime import datetime now = datetime.now() mm = str(now.month) dd = st