Re: syntax error (?) on ubuntu

2018-05-03 Thread Ned Batchelder
On 5/3/18 9:11 AM, Joel Goldstick wrote: On Thu, May 3, 2018 at 9:06 AM, joseph pareti wrote: $ python tf_simple.py /anaconda/envs/py35/lib/python3.5/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. I

Re: syntax error (?) on ubuntu

2018-05-03 Thread Joel Goldstick
On Thu, May 3, 2018 at 9:06 AM, joseph pareti wrote: > $ python tf_simple.py > > /anaconda/envs/py35/lib/python3.5/site-packages/h5py/__init__.py:36: > FutureWarning: Conversion of the second argument of issubdtype from `float` > to `np.floating` is deprecated. In future, it will be treated as > `

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

RE: syntax error in first-time user script

2017-03-25 Thread Deborah Swanson
john polo wrote, on March 25, 2017 2:45 PM > > I had a misconception of how the Python interpreter works. If > I have a > script, call it example.py, in order to run it, I shouldn't be in the > interpreter? In other words, I should be at the Windows > command prompt, > for example > > C:/tes

Re: syntax error in first-time user script

2017-03-25 Thread john polo
I had a misconception of how the Python interpreter works. If I have a script, call it example.py, in order to run it, I shouldn't be in the interpreter? In other words, I should be at the Windows command prompt, for example C:/test> python example.py and not >>> python example.py ? So, if

Re: syntax error in first-time user script

2017-03-24 Thread Terry Reedy
On 3/23/2017 9:57 PM, john polo wrote: If I use IDLE shell: "python comment.py" "SyntaxError: invalid syntax" IDLE's Shell runs your input with nearly identical results as with the standard interactive interpreter, including exceptions. I know I can open the file in the editor and use F5

Re: syntax error in first-time user script

2017-03-24 Thread john polo
On 3/24/2017 9:11 AM, Bob Gailer wrote: On Mar 24, 2017 4:53 AM, "john polo" > wrote: > > Greetings, > I am attempting to learn Python. I have no programming background. I'm on a computer with Windows 7. I checked the PATH in System Variables and Python and Python\S

Re: syntax error in first-time user script

2017-03-24 Thread Bob Gailer
On Mar 24, 2017 4:53 AM, "john polo" wrote: > > Greetings, > I am attempting to learn Python. I have no programming background. I'm on a computer with Windows 7. I checked the PATH in System Variables and Python and Python\Scripts are in the path. I have a book, Python for Biologists and it suppli

Re: syntax error in first-time user script

2017-03-24 Thread Peter Otten
john polo wrote: > Greetings, > I am attempting to learn Python. I have no programming background. I'm > on a computer with Windows 7. I checked the PATH in System Variables and > Python and Python\Scripts are in the path. I have a book, Python for > Biologists and it supplies example scripts, one

Re: Syntax error (The Python Book) Linux User and Developer Bookazine

2016-02-15 Thread Larry Hudson via Python-list
On 02/15/2016 07:06 AM, Joel Goldstick wrote: [snip a lot...] Learn Python the Hard Way is pretty good some people say. Its online. Also Diving into Python is online written by the now offline Mark Pilgrim. I have a couple of "Hard Way" books and personally, I don't like his style of teachin

Re: Syntax error (The Python Book) Linux User and Developer Bookazine

2016-02-15 Thread Geoff Munn
On Monday, 15 February 2016 15:07:03 UTC, Joel Goldstick wrote: > On Mon, Feb 15, 2016 at 9:56 AM, Geoff Munn wrote: > > > On Sunday, 14 February 2016 13:39:52 UTC, Geoff Munn wrote: > > > Hi, > > > > > > Noob at the Python thing so here goes, > > > > > > I have copied a program to demonstrate

Re: Syntax error (The Python Book) Linux User and Developer Bookazine

2016-02-15 Thread Joel Goldstick
On Mon, Feb 15, 2016 at 9:56 AM, Geoff Munn wrote: > On Sunday, 14 February 2016 13:39:52 UTC, Geoff Munn wrote: > > Hi, > > > > Noob at the Python thing so here goes, > > > > I have copied a program to demonstrate control structures in Python but > get a syntax error at line 31, isint = False.

Re: Syntax error (The Python Book) Linux User and Developer Bookazine

2016-02-15 Thread Geoff Munn
On Sunday, 14 February 2016 13:39:52 UTC, Geoff Munn wrote: > Hi, > > Noob at the Python thing so here goes, > > I have copied a program to demonstrate control structures in Python but get a > syntax error at line 31, isint = False. I'm using Python 2.7.6 and Linux Mint > based around ubuntu14

Re: Syntax error (The Python Book) Linux User and Developer Bookazine

2016-02-14 Thread Chris Angelico
On Mon, Feb 15, 2016 at 12:39 AM, Geoff Munn wrote: > Hi, > > Noob at the Python thing so here goes, > > I have copied a program to demonstrate control structures in Python but get a > syntax error at line 31, isint = False. I'm using Python 2.7.6 and Linux Mint > based around ubuntu14.04.1. I h

Re: Syntax error (The Python Book) Linux User and Developer Bookazine

2016-02-14 Thread Peter Otten
Geoff Munn wrote: > Noob at the Python thing so here goes, > > I have copied a program to demonstrate control structures in Python but > get a syntax error at line 31, isint = False. Often the actual syntax error in your code is in one of the lines preceding the one that Python is complaining

Re: Syntax error

2015-01-10 Thread Steven D'Aprano
Abdul Abdul wrote: > Hello, > > I have the following program that employs the dcm2jpg.exe software: > > import os > os.system(“dcm2jpg.exe IM-0004-0004.dcm”) > exit > > When I tried to run it, I got the following error: > > SyntaxError: Non-ASCII character '\xe2' in file dicomjpg.py on line 2,

Re: Syntax error

2015-01-10 Thread Dave Angel
On 01/10/2015 04:36 PM, Abdul Abdul wrote: Hello, I have the following program that employs the dcm2jpg.exe software: import os os.system(“dcm2jpg.exe IM-0004-0004.dcm”) exit When I tried to run it, I got the following error: SyntaxError: Non-ASCII character '\xe2' in file dicomjpg.py on line

Re: Syntax error

2015-01-10 Thread Peter Otten
Abdul Abdul wrote: > Hello, > > I have the following program that employs the dcm2jpg.exe software: > > import os > os.system(“dcm2jpg.exe IM-0004-0004.dcm”) > exit > > When I tried to run it, I got the following error: > > SyntaxError: Non-ASCII character '\xe2' in file dicomjpg.py on line 2,

Re: Syntax error

2015-01-10 Thread Joel Goldstick
On Sat, Jan 10, 2015 at 4:36 PM, Abdul Abdul wrote: > > Hello, > > I have the following program that employs the dcm2jpg.exe software: > > import os > os.system(“dcm2jpg.exe IM-0004-0004.dcm”) > exit > It may be that your actual code has ascii quote characters, but you have sent your question as r

Re: Syntax error in python unittest script

2014-09-24 Thread Terry Reedy
On 9/24/2014 3:33 PM, Milson Munakami wrote: I am learning to use unittest with python [way too long example] File "TestTest.py", line 44 def cleanup(self, success): ^ SyntaxError: invalid syntax A common recommendation is to find the *minimal* example that exhibits the proble

Re: Syntax error in python unittest script

2014-09-24 Thread Mark Lawrence
On 24/09/2014 21:06, Milson Munakami wrote: [snipped all the usual garbage] Would you please access this list via https://mail.python.org/mailman/listinfo/python-list or read and action this https://wiki.python.org/moin/GoogleGroupsPython to prevent us seeing double line spacing and single li

Re: Syntax error in python unittest script

2014-09-24 Thread Milson Munakami
On Wednesday, September 24, 2014 1:33:35 PM UTC-6, Milson Munakami wrote: > Hi, > > > > I am learning to use unittest with python and walkthrough with this example > > http://agiletesting.blogspot.com/2005/01/python-unit-testing-part-1-unittest.html > > > Thanks > so my test script is like th

Re: Syntax error in python unittest script

2014-09-24 Thread Peter Otten
Milson Munakami wrote: > if self.reportStatus_: > self.log.info("=== Test %s completed normally (%d > sec)", self.name_, duration The info() call is missing the closing parenthesis > def cleanup(self, success): > sys.excepthook =

Re: Syntax error in python unittest script

2014-09-24 Thread Emile van Sebille
On 9/24/2014 12:33 PM, Milson Munakami wrote: def tearDown(self): if self.failed: return duration = time.time() - self.startTime_ self.cleanup(True) if self.reportStatus_: self.

Re: syntax error message

2012-07-12 Thread MRAB
On 12/07/2012 18:48, John Magness wrote: Using Python 3.2.3 In shell I made a simple program; dog=2,cat=3,cow=dog+cat Entered cow and received 5 as answer Saved-as Trial-1.py in a user folder Went to folder and select "edit with shell" for that file Trial-1.py displayed, clicked save, run and the

Re: Syntax Error

2011-03-19 Thread Terry Reedy
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?

Re: Syntax Error

2011-03-19 Thread Manatee
On Mar 19, 3:26 am, Steven D'Aprano 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, everyon

Re: Syntax Error

2011-03-19 Thread Manatee
On Mar 19, 3:26 am, Steven D'Aprano 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:8683

Re: Syntax Error

2011-03-19 Thread Manatee
On Mar 19, 3:26 am, Steven D'Aprano 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, everyon

Re: Syntax Error

2011-03-19 Thread Manatee
On Mar 19, 2:00 am, Terry Reedy wrote: > On 3/19/2011 1:03 AM, Vlastimil Brom wrote: > > > 2011/3/19 Manatee: > >> I hope this is the place to post this question. > > Yes. > Lesson 1. Report Python version used, as things change. For anything > that seems like it might by os/system specific, inclu

Re: Syntax Error

2011-03-19 Thread Manatee
On Mar 19, 1:03 am, Vlastimil Brom wrote: > 2011/3/19 Manatee : > > > 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 li

Re: Syntax Error

2011-03-19 Thread Steven D'Aprano
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

Re: Syntax Error

2011-03-18 Thread Terry Reedy
On 3/19/2011 1:03 AM, Vlastimil Brom wrote: 2011/3/19 Manatee: I hope this is the place to post this question. Yes. Lesson 1. Report Python version used, as things change. For anything that seems like it might by os/system specific, include that too. Lesson 2. Always include tracebacks when

Re: Syntax Error

2011-03-18 Thread Vlastimil Brom
2011/3/19 Manatee : > 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. I am using Python > 2.

Re: Syntax Error

2011-03-18 Thread Thomas L. Shinnick
At 11:39 PM 3/18/2011, 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. I am using

Re: Syntax Error

2011-03-18 Thread xDog Walker
On Friday 2011 March 18 21:39, 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 probl

Re: syntax error : first python program

2009-12-23 Thread Ben Finney
Anssi Saari writes: > At least here with Python 2.5.2 I get "IndentationError: unexpected > indent". I'm just wondering why would the OP get a SyntaxError? $ python2.4 -c ' pass' File "", line 1 pass ^ SyntaxError: invalid syntax $ python2.5 -c ' pass' File "", line 1 pass ^

Re: syntax error : first python program

2009-12-23 Thread Anssi Saari
Ben Finney writes: >> bash# /usr/bin/python sample.py >> File "sample.py", line 2 >> name = "blah" >> ^ >> SyntaxError: invalid syntax > > Indentation is syntax in Python. At least here with Python 2.5.2 I get "IndentationError: unexpected indent". I'm just wondering why would the OP g

Re: syntax error : first python program

2009-12-23 Thread Bearophile
Ben Finney: > > bash# /usr/bin/python sample.py > >   File "sample.py", line 2 > >     name = "blah" > >     ^ > > SyntaxError: invalid syntax > > Indentation is syntax in Python. But I agree, a little better error message may help there, something that contains "indentation" in it :-) Bye, bear

Re: syntax error : first python program

2009-12-22 Thread Ben Finney
pradeep writes: > #!/usr/bin/env python > name = "blah" > print name These two lines are indented, but are not inside a block. > bash# /usr/bin/python sample.py > File "sample.py", line 2 > name = "blah" > ^ > SyntaxError: invalid syntax Indentation is syntax in Python. > An

Re: syntax error : first python program

2009-12-22 Thread Erik Max Francis
pradeep wrote: I have this file in linux === sample.py #!/usr/bin/env python name = "blah" print name ... Any one knows , whats the syntax error here? You're indenting for no reason. -- Erik Max Francis && m...@alcyone.com && http://www.alcyone.com/max/ San Jos

Re: Syntax error when importing a file which starts with a number

2009-03-23 Thread simon . woolf
> So in a sorted list of files, some of the project 1.2 files will > appear under 1-2 and others miles away under 1_2 ? And even if > the submitter is not so dopey, the submittee has two different > possibilities when looking for project 1.2's files? Brilliant! And > this is an educational

Re: Syntax error when importing a file which starts with a number

2009-03-23 Thread John Machin
On Mar 24, 9:12 am, simon.wo...@gmail.com wrote: > Many thanks to all for explanations.  I'm going to take everyone's > advice and ignore the naming scheme (especially as, on rereading, the > naming scheme is apparently only mandatory if you're using C or Maple, > for some reason). > > Thanks again

Re: Syntax error when importing a file which starts with a number

2009-03-23 Thread simon . woolf
Many thanks to all for explanations. I'm going to take everyone's advice and ignore the naming scheme (especially as, on rereading, the naming scheme is apparently only mandatory if you're using C or Maple, for some reason). Thanks again. Simon (For those interested: > Do you mean that some au

Re: Syntax error when importing a file which starts with a number

2009-03-23 Thread John Machin
On Mar 24, 4:56 am, simon.wo...@gmail.com wrote: > It's a bit annoying, as I have an enforced naming scheme. Do you mean that some authority other than yourself is seriously insisting that the names of source files *must* start with one or more digits? What is the rationale for such a scheme? --

Re: Syntax error when importing a file which starts with a number

2009-03-23 Thread andrew cooke
andrew cooke wrote: ffs. feature, not bug. sorry. > This is probably quite fundamental (I guess the lexer will implement it) > so suspect it is impossible to change. That means it is a bug, not a > feature (and it's quite a reasonable restriction, since it reduces > ambiguity). -- http://mai

Re: Syntax error when importing a file which starts with a number

2009-03-23 Thread MRAB
simon.wo...@gmail.com wrote: Hello, all. I don't suppose anyone has any idea why it seems to be impossible to import any file which starts with a number? You get a syntax error, whether the file exists or not. Try it yourself: import foo ImportError: No module named foo import 1foo Fil

Re: Syntax error when importing a file which starts with a number

2009-03-23 Thread andrew cooke
The grammar indicates that the module name is an identifier, and identifiers can't start with digits (you can't have a variable name that starts with a '1' either). This is probably quite fundamental (I guess the lexer will implement it) so suspect it is impossible to change. That means it is a

Re: Syntax error when importing a file which starts with a number

2009-03-23 Thread Gabriel Genellina
En Mon, 23 Mar 2009 14:56:21 -0300, escribió: I don't suppose anyone has any idea why it seems to be impossible to import any file which starts with a number? You get a syntax error, whether the file exists or not. You don't import a file, you import a module. And a module name is an ident

Re: Syntax error when importing a file which starts with a number

2009-03-23 Thread Miles
On Mon, Mar 23, 2009 at 1:56 PM, wrote: > Hello, all. > > I don't suppose anyone has any idea why it seems to be impossible to > import any file which starts with a number?  You get a syntax error, > whether the file exists or not. Identifiers can't start with a number. http://docs.python.org/r

Re: Syntax error when importing a file which starts with a number

2009-03-23 Thread simon . woolf
Forgot to mention: I'm on Python 2.5.2, on Ubuntu 8.10. Simon -- http://mail.python.org/mailman/listinfo/python-list

Re: Syntax error for print

2008-12-25 Thread Christian Heimes
jsm4...@gmail.com schrieb: > Thanks Bearophile. > > I should have used a tutorial for Python 3.0 > > I was reading tutorial for Python 2.5 Get Python 2.5 or 2.6, seriously. Python 3.0 is not (yet) supported by most tutorials, third party extensions and books. Christian -- http://mail.python.or

Re: Syntax error for print

2008-12-25 Thread jsm4321
Thanks Bearophile. I should have used a tutorial for Python 3.0 I was reading tutorial for Python 2.5 On Dec 25, 11:58 pm, bearophileh...@lycos.com wrote: > On Dec 25, 7:53 pm, jsm4...@gmail.com wrote: > > > > > IDLE 3.0>>> print "hello" > > > SyntaxError: invalid syntax (, line 1)>>> 3+3 > > 6

Re: Syntax error for print

2008-12-25 Thread bearophileHUGS
On Dec 25, 7:53 pm, jsm4...@gmail.com wrote: > IDLE 3.0>>> print "hello" > > SyntaxError: invalid syntax (, line 1)>>> 3+3 > 6 > >>> var = 4 > >>> var = var*4 > >>> print var > > SyntaxError: invalid syntax (, line 1) > > > > Any idea on why I am getting this error. > I have just started learning p

Re: Syntax error in ".py" file and globals variable values not available.

2008-08-29 Thread Timothy Grant
On Fri, Aug 29, 2008 at 12:48 AM, Alexis Boutillier <[EMAIL PROTECTED]> wrote: > Timothy Grant a écrit : >> >> On Thu, Aug 28, 2008 at 1:40 AM, Alexis Boutillier >> <[EMAIL PROTECTED]> wrote: >>> >>> Timothy Grant a écrit : On Wed, Aug 27, 2008 at 2:49 AM, Alexis Boutillier <[EMAIL P

Re: Syntax error in ".py" file and globals variable values not available.

2008-08-29 Thread Alexis Boutillier
Timothy Grant a écrit : On Thu, Aug 28, 2008 at 1:40 AM, Alexis Boutillier <[EMAIL PROTECTED]> wrote: Timothy Grant a écrit : On Wed, Aug 27, 2008 at 2:49 AM, Alexis Boutillier <[EMAIL PROTECTED]> wrote: Hi, I have a strange behaviour of python with pdb and import statement. Here is the examp

Re: Syntax error in ".py" file and globals variable values not available.

2008-08-28 Thread Timothy Grant
On Thu, Aug 28, 2008 at 1:40 AM, Alexis Boutillier <[EMAIL PROTECTED]> wrote: > Timothy Grant a écrit : >> >> On Wed, Aug 27, 2008 at 2:49 AM, Alexis Boutillier >> <[EMAIL PROTECTED]> wrote: >>> >>> Hi, >>> >>> I have a strange behaviour of python with pdb and import statement. >>> Here is the exam

Re: Syntax error in ".py" file and globals variable values not available.

2008-08-28 Thread Alexis Boutillier
Timothy Grant a écrit : On Wed, Aug 27, 2008 at 2:49 AM, Alexis Boutillier <[EMAIL PROTECTED]> wrote: Hi, I have a strange behaviour of python with pdb and import statement. Here is the example code : file my1.py: import my2 file my2.py: a=5 toto I intentionnaly put a syntax error in file my

Re: Syntax error in ".py" file and globals variable values not available.

2008-08-27 Thread Timothy Grant
On Wed, Aug 27, 2008 at 2:49 AM, Alexis Boutillier <[EMAIL PROTECTED]> wrote: > Hi, > > I have a strange behaviour of python with pdb and import statement. > Here is the example code : > > file my1.py: > import my2 > > file my2.py: > a=5 > toto > > I intentionnaly put a syntax error in file my2.py.

Re: Syntax error in my script

2008-07-30 Thread laredotornado
On Jul 30, 11:26 am, Alan Franzoni <[EMAIL PROTECTED]> wrote: > laredotornadowas kind enough to say: > > [cut] > > Indentation counts in Python. You're probably doing something wrong with > whitespace/tab/carriage return. > > -- > Alan Franzoni <[EMAIL PROTECTED]> > - > Remove .xyz from my email in

Re: Syntax error in my script

2008-07-30 Thread Alan Franzoni
laredotornado was kind enough to say: [cut] Indentation counts in Python. You're probably doing something wrong with whitespace/tab/carriage return. -- Alan Franzoni <[EMAIL PROTECTED]> - Remove .xyz from my email in order to contact me. - GPG Key Fingerprint: 5C77 9DC3 BD5B 3A28 E7BC 921A 02

Re: syntax error in python

2008-02-20 Thread Tim Roberts
Lalit <[EMAIL PROTECTED]> wrote: >Hi >I am executing following commands. test = os.path.isfile('c:\\src\\kasjdfl.txt') print test >True >working fine but for below statement it is giving syntax >error. > if (os.path.isfile('c:\\src\\kasjdfl.txt')) >SyntaxError: invalid s

Re: syntax error in python

2008-02-20 Thread Lalit
On Feb 20, 2:03 pm, Lalit <[EMAIL PROTECTED]> wrote: > Hi > I am executing following commands.>>> test = > os.path.isfile('c:\\src\\kasjdfl.txt') > >>> print test > > True > working fine but for below statement it is giving syntax > error. > > >>> if (os.path.isfile('c:\\src\\kasjdfl.t

Re: Syntax error

2007-04-17 Thread Diez B. Roggisch
hg wrote: > Hi, > > I've had this problem in the past and still cannot fully understand. > > I latelly passed my source code in Wing IDE wihch asked be to resolve > tab/space/CRLF conflicts and I said yes (initially the code was developped > under Linux ... and now all source got tabs replaced b

Re: Syntax error

2007-04-17 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, hg wrote: > I had the customer comment out the first two lines of the file: > > """ > #!/bin/env python > # -*- coding: iso-8859-15 -*- > """ > > ... and the problem disappeared. > > I am at a loss. > > Any clue ? There was once a bug in Python that lead to such "error

Re: Syntax error

2007-04-17 Thread hg
Marc 'BlackJack' Rintsch wrote: > In <[EMAIL PROTECTED]>, hg wrote: > >> I had the customer comment out the first two lines of the file: >> >> """ >> #!/bin/env python >> # -*- coding: iso-8859-15 -*- >> """ >> >> ... and the problem disappeared. >> >> I am at a loss. >> >> Any clue ? > > Th

Re: Syntax error

2007-04-17 Thread hg
Diez B. Roggisch wrote: > hg wrote: > >> Hi, >> >> I've had this problem in the past and still cannot fully understand. >> >> I latelly passed my source code in Wing IDE wihch asked be to resolve >> tab/space/CRLF conflicts and I said yes (initially the code was >> developped under Linux ... an

RE: syntax error in sum(). Please explicate.

2006-11-19 Thread Delaney, Timothy (Tim)
John Machin wrote: > Michael Press wrote: >> I have not written python codes nor run any. I saw this >> code posted and decided to try it. It fails. I read the >> tutorial and the entry for the built in function sum, >> but still do not see the problem. The code was cut and >> paste. > > I doubt

Re: syntax error in sum(). Please explicate.

2006-11-19 Thread Fredrik Lundh
Bjoern Schliessmann wrote: > Are generator comprehensions and generator expressions the same? the documentation uses the word "expression", not comprehension. -- http://mail.python.org/mailman/listinfo/python-list

Re: syntax error in sum(). Please explicate.

2006-11-19 Thread Bjoern Schliessmann
Paul Rubin wrote: > Generator comprehensions Are generator comprehensions and generator expressions the same? Regards, Björn -- BOFH excuse #35: working as designed -- http://mail.python.org/mailman/listinfo/python-list

Re: syntax error in sum(). Please explicate.

2006-11-18 Thread Tim Peters
[Matt Moriarity] >> try surrounding your sum argument in brackets: >> >> sum([phi(x // ps[i+1], i) for i in range(a)]) >> >> instead of: >> >> sum(phi(x // ps[i+1], i) for i in range(a)) [Michael Press] > Thank you. That makes it work. But is a wrong solution ;-) As others have suggested, it's a

Re: syntax error in sum(). Please explicate.

2006-11-18 Thread Michael Press
In article <[EMAIL PROTECTED]> , "Matt Moriarity" <[EMAIL PROTECTED]> wrote: > try surrounding your sum argument in brackets: > > sum([phi(x // ps[i+1], i) for i in range(a)]) > > instead of: > > sum(phi(x // ps[i+1], i) for i in range(a)) Thank you. That makes it work. -- Michael Press --

Re: syntax error in sum(). Please explicate.

2006-11-18 Thread John Machin
Michael Press wrote: > I have not written python codes nor run any. I saw this > code posted and decided to try it. It fails. I read the > tutorial and the entry for the built in function sum, > but still do not see the problem. The code was cut and > paste. I doubt it -- "none" should be "None"

Re: syntax error in sum(). Please explicate.

2006-11-18 Thread Paul Rubin
Michael Press <[EMAIL PROTECTED]> writes: > File "/Users/mdp/source/prime_counter_python", line 6 > return x - sum(phi(x // ps[i+1], i) for i in range(a)) > ^ > SyntaxError: invalid syntax > > Here are some lines from python -v: > > Python 2.3 (#1,

Re: syntax error in sum(). Please explicate.

2006-11-18 Thread Matt Moriarity
try surrounding your sum argument in brackets: sum([phi(x // ps[i+1], i) for i in range(a)]) instead of: sum(phi(x // ps[i+1], i) for i in range(a)) On Nov 18, 5:23 pm, Michael Press <[EMAIL PROTECTED]> wrote: > I have not written python codes nor run any. I saw this > code posted and decided t

Re: syntax error in sum(). Please explicate.

2006-11-18 Thread tom
Michael Press wrote: > I have not written python codes nor run any. I saw this > code posted and decided to try it. It fails. I read the > tutorial and the entry for the built in function sum, > but still do not see the problem. The code was cut and > paste. Please help. Thanks. > > ___

Re: syntax error

2006-01-10 Thread Sheldon
Hi Fredrik, I am using python 2.3.3 I am checking now the previous lines for errors. Thanks, Sheldon -- http://mail.python.org/mailman/listinfo/python-list

Re: syntax error

2006-01-10 Thread Sheldon
Hi Rod, You were right. The error was on the previous line. I will remember that. Thanks for your help! Sheldon -- http://mail.python.org/mailman/listinfo/python-list

Re: syntax error

2006-01-10 Thread Sheldon
Hi Rod, This sounds very interesting. I am checking the previous lines and will get back to you. Thanks, Sheldon -- http://mail.python.org/mailman/listinfo/python-list

Re: syntax error

2006-01-10 Thread Fredrik Lundh
"Sheldon" wrote: > I am new here but I am pretty good at python programming but I am not > exert. I have been away from programming for about a year and now I am > programming in python again in combination with IDL. > I came across a error that puzzles me and I need some help. It is > pretty simp

  1   2   >