Re: >>> %matplotlib inline results in SyntaxError: invalid syntax

2023-12-25 Thread MRAB via Python-list
On 2023-12-25 19:53, Alan Gauld via Python-list wrote: On 25/12/2023 05:34, geetanajali homes via Python-list wrote: import numpy as np import pandas as pd import random import matplotlib.pyplot as plt %matplotlib inline I get an error on the last line. I am running this code in Idle Pytho

Re: >>> %matplotlib inline results in SyntaxError: invalid syntax

2023-12-25 Thread Chris Angelico via Python-list
On Tue, 26 Dec 2023 at 07:27, Chris Grace via Python-list wrote: > I'd also recommend a newer version of python. Python 3.4 reached end of > life almost 5 years ago. Uhh, putting this in perspective... until a spammer revived the thread just now, it was asked, answered, and finished with, all bac

Re: >>> %matplotlib inline results in SyntaxError: invalid syntax

2023-12-25 Thread Chris Grace via Python-list
"%matplotlib inline" is a magic command that changes how plots render when working with IPython. Read more here: https://stackoverflow.com/a/43028034 The article you linked assumes you are working in an IPython shell, not IDLE. This is common in the data science world. You may already have IPytho

Re: >>> %matplotlib inline results in SyntaxError: invalid syntax

2023-12-25 Thread Alan Gauld via Python-list
On 25/12/2023 05:34, geetanajali homes via Python-list wrote: >> import numpy as np >> import pandas as pd >> import random >> import matplotlib.pyplot as plt >> %matplotlib inline >> >> I get an error on the last line. I am running this code in Idle Python >> 3.4.4 Shell... Python names c

Re: >>> %matplotlib inline results in SyntaxError: invalid syntax

2023-12-25 Thread geetanajali homes via Python-list
copyright", "credits" or "license()" for more information. > >>> import numpy as np > >>> import pandas as pd > >>> import random > >>> import matplotlib.pyplot as plt > >>> %matplotlib inline > SyntaxErr

Re: Why is augmented assignment of a tuple with iterable unpacking invalid syntax?

2019-05-19 Thread Piet van Oostrum
Eugene Alterman writes: > a = 1, 2, 3 > > b = *a, # assignment - OK > b += *a, # augmented assignment - syntax error > > Need to enclose in parenthesis: > > b += (*a,) > > Why isn't it allowed with an augmented assignment, while it is OK with a > regular assignment? > Syntacti

Why is augmented assignment of a tuple with iterable unpacking invalid syntax?

2019-05-19 Thread Eugene Alterman
a = 1, 2, 3 b = *a, # assignment - OK b += *a, # augmented assignment - syntax error Need to enclose in parenthesis: b += (*a,) Why isn't it allowed with an augmented assignment, while it is OK with a regular assignment? -- https://mail.python.org/mailman/listinfo/python-

Re: Spot the invalid syntax

2018-03-08 Thread Steven D'Aprano
On Fri, 09 Mar 2018 00:47:21 +, MRAB wrote: > On 2018-03-08 23:57, Ben Finney wrote: >> You mean the tool is not always looking for mistakes while you type? [...] >> Certainly it'd be good to always have a *perfect* overseer checking for >> mistakes . Until that happy day, though, let's use t

Re: Spot the invalid syntax

2018-03-08 Thread MRAB
On 2018-03-08 23:57, Ben Finney wrote: Chris Angelico writes: On Fri, Mar 9, 2018 at 10:33 AM, Ben Finney wrote: > In many cases, those eyes can be virtual and non-human. > > That's what syntax highlighting, and tools even more impressive > (e.g. linting tools that run continually), offer in

Re: Spot the invalid syntax

2018-03-08 Thread Ian Pilcher
On 03/08/2018 05:30 PM, Ben Finney wrote: Not sufficiently, it seems. Check the line preceding the ‘return’ statement. Indeed. :-/ Then, switch to using a programmer's text editor (I prefer Emacs) that can spot these syntax errors while you type. The sad thing is that I am. Just too bone-

Re: Spot the invalid syntax

2018-03-08 Thread Ian Pilcher
On 03/08/2018 05:26 PM, Chris Angelico wrote: On Fri, Mar 9, 2018 at 10:23 AM, Ian Pilcher wrote: (Because I certainly can't.) ips.update(_san_dnsname_ips(cname, True) return ips I've checked for tabs and mismatched parentheses. Check the immediately preceding line (t

Re: Spot the invalid syntax

2018-03-08 Thread Bob van der Poel
cname in cnames: >> if not cname.endswith('.'): >> cname = u'%s.%s' % (cname, zone) >> ips.update(_san_dnsname_ips(cname, True) >> return ips >> > > 2.7 and 3.6 are

Re: Spot the invalid syntax

2018-03-08 Thread Terry Reedy
put the '|', thus indicating that there is no ')' matching the function call '(' return ips If you delete the helpful indent signal to type return here, ... 2.7 and 3.6 are both giving me: File "/tmp/test.py", line 32 return ips

Re: Spot the invalid syntax

2018-03-08 Thread MRAB
) else: for cname in cnames: if not cname.endswith('.'): cname = u'%s.%s' % (cname, zone) ips.update(_san_dnsname_ips(cname, True) return ips 2.7 and 3.6 are both giving me: File "/tmp/test.py&q

Re: Spot the invalid syntax

2018-03-08 Thread Chris Angelico
On Fri, Mar 9, 2018 at 10:57 AM, Ben Finney wrote: > Chris Angelico writes: > >> On Fri, Mar 9, 2018 at 10:33 AM, Ben Finney >> wrote: >> > In many cases, those eyes can be virtual and non-human. >> > >> > That's what syntax highlighting, and tools even more impressive >> > (e.g. linting tools

Re: Spot the invalid syntax

2018-03-08 Thread Ben Finney
Chris Angelico writes: > On Fri, Mar 9, 2018 at 10:33 AM, Ben Finney > wrote: > > In many cases, those eyes can be virtual and non-human. > > > > That's what syntax highlighting, and tools even more impressive > > (e.g. linting tools that run continually), offer in a programmer's > > text edito

Re: Spot the invalid syntax

2018-03-08 Thread Chris Angelico
On Fri, Mar 9, 2018 at 10:33 AM, Ben Finney wrote: > Chris Angelico writes: > >> (Sometimes, you just need another pair of eyes.) > > In many cases, those eyes can be virtual and non-human. > > That's what syntax highlighting, and tools even more impressive (e.g. > linting tools that run continua

Re: Spot the invalid syntax

2018-03-08 Thread Ben Finney
Chris Angelico writes: > (Sometimes, you just need another pair of eyes.) In many cases, those eyes can be virtual and non-human. That's what syntax highlighting, and tools even more impressive (e.g. linting tools that run continually), offer in a programmer's text editor: a pair of eyes lookin

Re: Spot the invalid syntax

2018-03-08 Thread Ben Finney
Ian Pilcher writes: > > ips.update(_san_dnsname_ips(cname, True) > > return ips > > 2.7 and 3.6 are both giving me: > > File "/tmp/test.py", line 32 > return ips > ^ > SyntaxError: invalid syntax > > I

Re: Spot the invalid syntax

2018-03-08 Thread Chris Angelico
On Fri, Mar 9, 2018 at 10:23 AM, Ian Pilcher wrote: > (Because I certainly can't.) > >> ips.update(_san_dnsname_ips(cname, True) >> return ips > > > 2.7 and 3.6 are both giving me: > > File "/tmp/test.py", line 32 > re

Spot the invalid syntax

2018-03-08 Thread Ian Pilcher
for cname in cnames: if not cname.endswith('.'): cname = u'%s.%s' % (cname, zone) ips.update(_san_dnsname_ips(cname, True) return ips 2.7 and 3.6 are both giving me: Fi

Re: Invalid Syntax

2016-08-09 Thread Steven D'Aprano
On Wed, 10 Aug 2016 06:20 am, Ltc Hotspot wrote: > Hi, Everyone: > > What is the source of the following, > 'error message: SyntaxError: invalid syntax (, line 2)' > > v. Python 3.3 > > Code reads: > > x=1 > if x==1 > # indent 4 spaces >

Re: Invalid Syntax

2016-08-09 Thread cs
On 09Aug2016 20:22, Rob Gaddi wrote: Ltc Hotspot wrote: What is the source of the following, 'error message: SyntaxError: invalid syntax (, line 2)' v. Python 3.3 Code reads: x=1 if x==1 # indent 4 spaces print "x = 1" A missing colon, the appropriate location

Re: Invalid Syntax

2016-08-09 Thread Rob Gaddi
Ltc Hotspot wrote: > Hi, Everyone: > > What is the source of the following, > 'error message: SyntaxError: invalid syntax (, line 2)' > > v. Python 3.3 > > Code reads: > > x=1 > if x==1 > # indent 4 spaces > print "x = 1" >

Invalid Syntax

2016-08-09 Thread Ltc Hotspot
Hi, Everyone: What is the source of the following, 'error message: SyntaxError: invalid syntax (, line 2)' v. Python 3.3 Code reads: x=1 if x==1 # indent 4 spaces print "x = 1" Hal -- https://mail.python.org/mailman/listinfo/python-list

>>> %matplotlib inline results in SyntaxError: invalid syntax

2016-01-29 Thread Mike S via Python-list
;>> import matplotlib.pyplot as plt >>> %matplotlib inline SyntaxError: invalid syntax What am I doing wrong? Suggested reading? TIA, Mike -- https://mail.python.org/mailman/listinfo/python-list

Re: >>> %matplotlib inline results in SyntaxError: invalid syntax

2016-01-29 Thread Mike S via Python-list
win32 Type "copyright", "credits" or "license()" for more information. >>> import numpy as np >>> import pandas as pd >>> import random >>> import matplotlib.pyplot as plt >>> %matplotlib inline SyntaxError: invalid

Re: >>> %matplotlib inline results in SyntaxError: invalid syntax

2016-01-29 Thread Steven D'Aprano
quot;copyright", "credits" or "license()" for more information. > >>> import numpy as np > >>> import pandas as pd > >>> import random > >>> import matplotlib.pyplot as plt > >>> %matplotlib inline > SyntaxE

Re: >>> %matplotlib inline results in SyntaxError: invalid syntax

2016-01-28 Thread Chris Angelico
ht", "credits" or "license()" for more information. >>>> import numpy as np >>>> import pandas as pd >>>> import random >>>> import matplotlib.pyplot as plt >>>> %matplotlib inline > SyntaxError: invalid syntax

Re: Why do I get SyntaxError: invalid syntax

2015-05-04 Thread Cecil Westerhof
#x27;, dir = filepath, delete = False) as tf: tempfile = tf.name >> with open(real_file, 'r') as f: for line in islice(f, 1, None): >> tf.write(line) rename(tempfile, real_file) >> >> But that gave: >> File "", line 6 >> rename(tempfile, real

Re: Why do I get SyntaxError: invalid syntax

2015-05-04 Thread Chris Angelico
tempfile = tf.name > with open(real_file, 'r') as f: > for line in islice(f, 1, None): > tf.write(line) > rename(tempfile, real_file) > > But that gave: > File "", line 6 > rename(tempfile, real_file)

Why do I get SyntaxError: invalid syntax

2015-05-04 Thread Cecil Westerhof
rite(line) rename(tempfile, real_file) But that gave: File "", line 6 rename(tempfile, real_file) ^ SyntaxError: invalid syntax Why? -- Cecil Westerhof Senior Software Engineer LinkedIn: http://www.linkedin.com/in/cecilwesterhof -- https://mail.python.org/mailman/listinfo/python-list

Re: Text Code(from 'Getting Started in Beautiful Soup' re: cd Soup , returns 'Syntax Error, invalid syntax'

2014-12-14 Thread Chris Angelico
On Mon, Dec 15, 2014 at 1:48 AM, Simon Evans wrote: > Thanks Guys > This book keeps swapping from the Python console to the Windows - without > telling you, but it is the only book out there on 'Beautiful Soup' so I have > got to put up with it. There's more problems with it, but I will start a

Re: Text Code(from 'Getting Started in Beautiful Soup' re: cd Soup , returns 'Syntax Error, invalid syntax'

2014-12-14 Thread Simon Evans
Thanks Guys This book keeps swapping from the Python console to the Windows - without telling you, but it is the only book out there on 'Beautiful Soup' so I have got to put up with it. There's more problems with it, but I will start a new thread in regard of, I don't know if its related to the

Re: Text Code(from 'Getting Started in Beautiful Soup' re: cd Soup , returns 'Syntax Error, invalid syntax'

2014-12-11 Thread Dave Angel
On 12/11/2014 02:40 PM, Chris Angelico wrote: On Fri, Dec 12, 2014 at 6:34 AM, Dave Angel wrote: Please give your environment when starting a new thread. Python version and OS version. In this case, I'm guessing Windows, because I have to guess something to give a meaningful answer. On 12/11

Re: Text Code(from 'Getting Started in Beautiful Soup' re: cd Soup , returns 'Syntax Error, invalid syntax'

2014-12-11 Thread Chris Angelico
On Fri, Dec 12, 2014 at 6:34 AM, Dave Angel wrote: > Please give your environment when starting a new thread. Python version and > OS version. In this case, I'm guessing Windows, because I have to guess > something to give a meaningful answer. > > On 12/11/2014 02:21 PM, Simon Evans wrote: >> Py

Re: Text Code(from 'Getting Started in Beautiful Soup' re: cd Soup , returns 'Syntax Error, invalid syntax'

2014-12-11 Thread Dave Angel
2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)] on win 32 Type "help", "copyright", "credits" or "license" for more information. cd Soup File "", line 1 cd Soup ^ SyntaxError: invalid syntax cd is not a

Re: Text Code(from 'Getting Started in Beautiful Soup' re: cd Soup , returns 'Syntax Error, invalid syntax'

2014-12-11 Thread sohcahtoa82
- > Python 2.7.6 (default, Nov 10 2013, 19:24:18) [MSC v.1500 32 bit (Intel)] on > win > 32 > Type "help", "copyright", "credits" or "license" for more information. > >>> cd Soup > File &qu

Text Code(from 'Getting Started in Beautiful Soup' re: cd Soup , returns 'Syntax Error, invalid syntax'

2014-12-11 Thread Simon Evans
SC v.1500 32 bit (Intel)] on win 32 Type "help", "copyright", "credits" or "license" for more information. >>> cd Soup File "", line 1 cd Soup ^ SyntaxError: invalid syntax >>> --

Re: Invalid Syntax Installing pip - ez_setup.py

2014-12-01 Thread Billy Furlong
Success. Whats happening is that the second wget command is not recognizing the --no-check-certificate. So I went around the problem and installed it manually. wget https://pypi.python.org/packages/source/s/setuptools/setuptools-7.0.zip --no-check-certificate unzip setuptools-7.0.zip python2.7

Re: Invalid Syntax Installing pip - ez_setup.py

2014-12-01 Thread Billy Furlong
Hi Chris, Yep that got me closer. I found that using | sudo python2.7 was a bad command. So I changed over to | python2.7. [root@myserver tmp]# wget https://bootstrap.pypa.io/ez_setup.py --no-check-certificate -O - | python2.7 --2014-12-01 12:57:07-- https://bootstrap.pypa.io/ez_setup.py Re

Re: Invalid Syntax Installing pip - ez_setup.py

2014-12-01 Thread Chris Angelico
t;", line 51 > with archive_context(archive_filename): > ^ > SyntaxError: invalid syntax When you run 'python', you apparently are getting the old version still. Try 'python2.7' instead. If you used a bash alias to change the meaning of the word

Invalid Syntax Installing pip - ez_setup.py

2014-12-01 Thread billyfurlong
saved [10476/10476] File "", line 51 with archive_context(archive_filename): ^ SyntaxError: invalid syntax Any help or direction would be greatly appreciated. Billy, -- https://mail.python.org/mailman/listinfo/python-list

Re: Invalid syntax with print "Hello World"

2013-11-14 Thread unknown
On Thu, 14 Nov 2013 07:05:08 -0800, johannes.gunz97 wrote: > Am Donnerstag, 12. März 2009 07:57:11 UTC+1 schrieb Henrik Bechmann: >> obviously total mewbiew: >> >> My first program in Python Windows >> >> print "Hello World" >> >> I select Run/Run Module and get an error: >> >> Syntax error, w

Re: Invalid syntax with print "Hello World"

2013-11-14 Thread bob gailer
On 11/14/2013 10:05 AM, johannes.gun...@gmail.com wrote: Am Donnerstag, 12. März 2009 07:57:11 UTC+1 schrieb Henrik Bechmann: obviously total mewbiew: My first program in Python Windows print "Hello World" I assume you are running Python 3 in which case you need print("Hello World") -- Bob

Re: Invalid syntax with print "Hello World"

2013-11-14 Thread johannes . gunz97
Am Donnerstag, 12. März 2009 07:57:11 UTC+1 schrieb Henrik Bechmann: > obviously total mewbiew: > > My first program in Python Windows > > print "Hello World" > > I select Run/Run Module and get an error: > > Syntax error, with the closing quote highlighted. > > Tried with single quotes as wel

Re: Invalid syntax with print "Hello World"

2013-04-13 Thread andygong . happy
On Thursday, March 12, 2009 3:25:53 PM UTC+8, John Machin wrote: > On Mar 12, 5:57 pm, Henrik Bechmann wrote: > > obviously total mewbiew: > > > > My first program in Python Windows > > What is that you are callind "Python Windows"? What version of Python > are you running? > > 2.X: print "Hello

Re: Psycopg2 SyntaxError: invalid syntax on "INSERT INTO" database

2013-01-09 Thread Mitya Sirenef
On Wed 09 Jan 2013 09:20:10 PM EST, andydtay...@gmail.com wrote: Thanks for your help guys. I was actually doing a few things wrong, but I have got this script to work by declaring fields as varchar and all values as strings. But I would like to log journey time values in hours/minutes, so I w

Re: Psycopg2 SyntaxError: invalid syntax on "INSERT INTO" database

2013-01-09 Thread andydtaylor
Thanks for your help guys. I was actually doing a few things wrong, but I have got this script to work by declaring fields as varchar and all values as strings. But I would like to log journey time values in hours/minutes, so I will have to look into the following: 1. Retrieving this data from

Re: Psycopg2 SyntaxError: invalid syntax on "INSERT INTO" database

2013-01-09 Thread MRAB
xp.py", line 15 cursor.execute("INSERT INTO tubecross (station_code, SAJ, SPB, SOQ) VALUES (%s, %s, %s, %s)",(SAJ, 00:00, 00:22, 00:27)) ^ SyntaxError: invalid syntax &qu

Re: Psycopg2 SyntaxError: invalid syntax on "INSERT INTO" database

2013-01-09 Thread Mitya Sirenef
t;INSERT INTO tubecross (station_code, SAJ, SPB, SOQ) VALUES (%s, %s, %s, %s)",(SAJ, 00:00, 00:22, 00:27)) ^ SyntaxError: invalid syntax Thanks for your help 00:00 etc are not quoted? - mitya -- Lark's Tongue Guide to Python: http://lightbird.net/larks/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Psycopg2 SyntaxError: invalid syntax on "INSERT INTO" database

2013-01-09 Thread andydtaylor
her/TFLJPAPI$ python creat_db_exp.py File "creat_db_exp.py", line 15 cursor.execute("INSERT INTO tubecross (station_code, SAJ, SPB, SOQ) VALUES (%s, %s, %s, %s)",(SAJ, 00:00, 00:22, 00:27))

Re: Psycopg2 SyntaxError: invalid syntax on "INSERT INTO" database

2013-01-09 Thread John Gordon
In andydtay...@gmail.com writes: > I'm a bit stuck on this "INSERT INTO" syntax error. I have no idea why it's What syntax error? It's always helpful if you can post the actual error message. > not working actually... I've tried changing column types to char but that > didn't work. I've gone

Psycopg2 SyntaxError: invalid syntax on "INSERT INTO" database

2013-01-09 Thread andydtaylor
Hi, I'm a bit stuck on this "INSERT INTO" syntax error. I have no idea why it's not working actually... I've tried changing column types to char but that didn't work. I've gone a bit blind looking at it, but hopefully you can set me right. With the '#'d out lines instead the file does work. Wh

Re: Invalid syntax

2012-11-07 Thread Smaran Harihar
Thanks a lot guys. Seriously when u get stuck on such issues it really drives u nuts and that is when this awesome comes to the rescue. This python mailing list rocks. On Wed, Nov 7, 2012 at 4:31 PM, Roy Smith wrote: > In article , > Demian Brecht wrote: > > > On 2012-11-07, at 3:17 PM, Smara

Re: Invalid syntax

2012-11-07 Thread Roy Smith
In article , Demian Brecht wrote: > On 2012-11-07, at 3:17 PM, Smaran Harihar wrote: > > Any idea where am I going wrong? > > Looks like you're missing a closing parenthesis: What I find is useful in situations like this is to just let emacs auto-indent the code. When it starts indenting (o

Re: Invalid syntax

2012-11-07 Thread R. Michael Weylandt
On Wed, Nov 7, 2012 at 11:17 PM, Smaran Harihar wrote: > Hi guys, > > I am stuck in one of those non identifiable error location in the code. The > code keeps giving invalid syntax. This is my code. > > I am using the same code for another code and not sure why this is not >

Re: Invalid syntax

2012-11-07 Thread Demian Brecht
On 2012-11-07, at 3:17 PM, Smaran Harihar wrote: > Any idea where am I going wrong? Looks like you're missing a closing parenthesis: w.record(collection[i][0], MAT[0], TSD[0], AnnTMin[0], ANNPREC[0], float(collection[i][2]), float(collection[i][1]) should be w.record(collection[i][0], MAT[0]

Invalid syntax

2012-11-07 Thread Smaran Harihar
Hi guys, I am stuck in one of those non identifiable error location in the code. The code keeps giving invalid syntax. This is my code<http://dpaste.com/826792/> . I am using the same code for another code and not sure why this is not working. This is the traceback <http://dpaste.c

Re: Invalid syntax error

2012-03-10 Thread Ian Kelly
e the problem here? >> >> l=[] >>>>> num=600851475143 >>>>> i=1 >>>>> while i<=num: >>...     if num%i==0: >>...         l.append(i) >>...     i+=1 >>... print max(l) >>  File "", line 5 >>    print

Re: Invalid syntax error

2012-03-10 Thread Günther Dietrich
>> i=1 >>>> while i<=num: >... if num%i==0: >... l.append(i) >... i+=1 >... print max(l) > File "", line 5 >print max(l) >^ >SyntaxError: invalid syntax You have to insert an empty line after the end of the while loop (befor

Re: Invalid syntax error

2012-03-10 Thread liuerfire Wang
i==0: > ... l.append(i) > ... i+=1 > ... print max(l) > File "", line 5 > print max(l) > ^ > SyntaxError: invalid syntax It is a indentation error. It should be like: >>> while i<=num: ... if num%i==0: ... l.append(i) ... i+=1 ... >>> print max(l) -- http://mail.python.org/mailman/listinfo/python-list

Re: Invalid syntax error

2012-03-10 Thread Ahsan
Just checked my version. Its showing 2.6.5. >>> sys.version '2.6.5 (r265:79063, Apr 16 2010, 13:09:56) \n[GCC 4.4.3]' -- http://mail.python.org/mailman/listinfo/python-list

Re: Invalid syntax error

2012-03-10 Thread Vlastimil Brom
  l.append(i) > ...     i+=1 > ... print max(l) >  File "", line 5 >    print max(l) >        ^ > SyntaxError: invalid syntax > > > -- > http://mail.python.org/mailman/listinfo/python-list Hi, if you are using python 3, you'd (most likely) need to adapt

Re: Invalid syntax error

2012-03-10 Thread Andrew Berg
... l.append(i) > ... i+=1 > ... print max(l) > File "", line 5 > print max(l) > ^ > SyntaxError: invalid syntax > > You must be using Python 3. Along with many, many other changes, Python 3 uses a print function instead of a prin

Re: Invalid syntax error

2012-03-10 Thread Amit Sethi
Its an indentation error -- A-M-I-T S|S -- http://mail.python.org/mailman/listinfo/python-list

Invalid syntax error

2012-03-10 Thread sl33k
ot;, line 5 print max(l) ^ SyntaxError: invalid syntax -- http://mail.python.org/mailman/listinfo/python-list

Re: Error invalid syntax while statement

2011-01-08 Thread Terry Reedy
15 print("counter: ", counter 16 17 while (end == 0): # <---returns syntax error on this while statement Among other responses, there is no indent after print. should be print() while x: #now i

Re: Error invalid syntax while statement

2011-01-07 Thread Garland Fulton
On Fri, Jan 7, 2011 at 8:55 PM, Chris Rebert wrote: > On Fri, Jan 7, 2011 at 9:46 PM, Garland Fulton > wrote: > > > 1 #!/bin/bash/python > > > What is > > wrong with my shebang line? > > Its path is invalid (unless you're using a *very* weird system). > /bin/bash is the bash shell executable

Re: Error invalid syntax while statement

2011-01-07 Thread Chris Rebert
On Fri, Jan 7, 2011 at 9:46 PM, Garland Fulton wrote: >   1 #!/bin/bash/python > What is > wrong with my shebang line? Its path is invalid (unless you're using a *very* weird system). /bin/bash is the bash shell executable; bash is completely unrelated to Python. Further, /bin/bash is a file, n

Re: Error invalid syntax while statement

2011-01-07 Thread Garland Fulton
On Fri, Jan 7, 2011 at 8:28 PM, Ned Deily wrote: > In article > , > Garland Fulton wrote: > > I don't understand what I'm doing wrong i've tried several different > cases > > for what i am doing here. Will someone please point my error out. > > > 15 print("counter: ", counter > > Missi

Re: Error invalid syntax while statement

2011-01-07 Thread Ned Deily
In article , Garland Fulton wrote: > I don't understand what I'm doing wrong i've tried several different cases > for what i am doing here. Will someone please point my error out. > 15 print("counter: ", counter Missing ")" on line 15. -- Ned Deily, n...@acm.org -- http://mail.p

Re: Error invalid syntax while statement

2011-01-07 Thread Chris Rebert
On Fri, Jan 7, 2011 at 9:18 PM, Garland Fulton wrote: > I don't understand what I'm doing wrong i've tried several different cases > for what i am doing here. Will someone please point my error out. > Thank you. > >   1 #!/bin/bash/python This shebang undoubtedly erroneous. >   5     if( 0 > x |

Error invalid syntax while statement

2011-01-07 Thread Garland Fulton
I don't understand what I'm doing wrong i've tried several different cases for what i am doing here. Will someone please point my error out. Thank you. 1 #!/bin/bash/python 2 import math 3 try: 4 x = int(input("Enter your number: ")) 5 if( 0 > x | x > 2147483647): 6 r

Re: Invalid Syntax Error

2010-01-14 Thread Benjamin Kaplan
How about you just isolate the first few lines On Thu, Jan 14, 2010 at 2:43 PM, Ray Holt wrote: > try: >     #open file stream >     file = open(file_name, "w" > except IOError: >     print "There was an error writing to", file_name >     sys.exit() Notice anything now? Something missing perhaps

Re: Invalid Syntax Error

2010-01-14 Thread MRAB
Ray Holt wrote: Why am I getting an invalid systax on the first except in the following code. It was copid from the python tutorial for beginners. Thanks, Ray import sys try: #open file stream file = open(file_name, "w" [snip] Missing ")". -- http://mail.python.org/mailman/listinfo/py

Invalid Syntax Error

2010-01-14 Thread Ray Holt
Why am I getting an invalid systax on the first except in the following code. It was copid from the python tutorial for beginners. Thanks, Ray import sys try: #open file stream file = open(file_name, "w" except IOError: print "There was an error writing to", file_name sys.exit() pri

Re: Invalid syntax error

2009-12-20 Thread Todd A. Jacobs
On Sun, Dec 20, 2009 at 08:40:05AM -0500, Ray Holt wrote: > Why am I getting an invalid syntax error on the following: > os.chdir(c:\\Python_Modules). The error message says the colon after c You need to pass either a string literal or a variable. If you're passing a string, like you

Re: Invalid syntax error

2009-12-20 Thread D'Arcy J.M. Cain
On Sun, 20 Dec 2009 08:40:05 -0500 "Ray Holt" wrote: > Why am I getting an invalid syntax error on the following: > os.chdir(c:\\Python_Modules). The error message says the colon after c is You forgot the quotes around the string. I am not on Windows but I think the followi

Re: Invalid syntax error

2009-12-20 Thread Xavier Ho
Putting quotemarks "" around the path would be a good start, I think. Cheers, Xav On Sun, Dec 20, 2009 at 11:40 PM, Ray Holt wrote: > Why am I getting an invalid syntax error on the following: > os.chdir(c:\\Python_Modules). The error message says the colon after c is > inv

Invalid syntax error

2009-12-20 Thread Ray Holt
Why am I getting an invalid syntax error on the following: os.chdir(c:\\Python_Modules). The error message says the colon after c is invalid syntax. Why is it saying this when I am trying to change directory to c:\Python_Modules. Thanks, Ray -- http://mail.python.org/mailman/listinfo/python-list

Re: ask help for a proble with invalid syntax

2009-10-13 Thread John Machin
         self.make = ConsProd.goods[2] >                self.tech = ConsProd.tech >                self.gross_production = (0.0,0.0,self. tech*G.L) >                ConsProd.total_production[2] += self.gross_production > [2] >                G.cps3[self] = self.gross_production[2] > > the h

Re: ask help for a proble with invalid syntax

2009-10-13 Thread Steven D'Aprano
On Tue, 13 Oct 2009 23:54:58 +0100, MRAB wrote: >> syntax error: >> There' an error in your program: invalid syntax. >> > There are also a number of spelling mistakes. Shame on you MRAB, you'll letting down the fine old Internet tradition that anytime you poi

Re: ask help for a proble with invalid syntax

2009-10-13 Thread MRAB
h = ConsProd.tech self.gross_production = (0.0,0.0,self. tech*G.L) ConsProd.total_production[2] += self.gross_production [2] G.cps3[self] = self.gross_production[2] the hint is the small window at python: syntax error: There' an error in your pro

Re: ask help for a proble with invalid syntax

2009-10-13 Thread Robert Kern
eeply appreciate! the program is below: the hint is the small window at python: syntax error: There' an error in your program: invalid syntax. Always copy-and-paste the complete error message. Do not try to paraphrase or retype the message. Your problem is this line: self.dema

ask help for a proble with invalid syntax

2009-10-13 Thread leo zhao
f.gross_production = (0.0,0.0,self. tech*G.L) ConsProd.total_production[2] += self.gross_production [2] G.cps3[self] = self.gross_production[2] the hint is the small window at python: syntax error: There' an error in your program: invalid syntax. -- http://mail.python.org/mailman/listinfo/python-list

Re: SyntaxError: invalid syntax (windows)

2009-03-25 Thread Terry Reedy
MRAB wrote: Python Newsgroup wrote: Gotcha, I got started from the telnet example listed in the docs. The linux install was via yum and installed 2.x instead. That explains it. Althought print (tn.read_all () ) runs in 2.x on linux. I have another problem maybe you cna help me with. My telnet

Re: SyntaxError: invalid syntax (windows)

2009-03-25 Thread MRAB
Python Newsgroup wrote: Gotcha, I got started from the telnet example listed in the docs. The linux install was via yum and installed 2.x instead. That explains it. Althought print (tn.read_all () ) runs in 2.x on linux. I have another problem maybe you cna help me with. My telnet output jibb

Re: SyntaxError: invalid syntax (windows)

2009-03-25 Thread Python Newsgroup
") tn.write("ls\n") tn.write("exit\n") print tn.read_all() Regardless of the script content, running in windows I constently get this SyntaxError: C:\Python30>python c:\Python30\scripts\telnet.py File "c:\Python30\scripts\telnet.py", line 20 print tn

Re: SyntaxError: invalid syntax (windows)

2009-03-25 Thread Python Newsgroup
if password: tn.read_until("Password: ") tn.write(password + "\n") tn.write("ls\n") tn.write("exit\n") print tn.read_all() Regardless of the script content, running in windows I constently get this SyntaxError: C:\Python30>python c:\Python30\script

Re: SyntaxError: invalid syntax (windows)

2009-03-25 Thread MRAB
30\scripts\telnet.py File "c:\Python30\scripts\telnet.py", line 20 print tn.read_all() ^ SyntaxError: invalid syntax C:\Python30> The same script works fine from linux. I have also notices some other slight differences: this is my original script that runs and completes but only if I commen

Re: SyntaxError: invalid syntax (windows)

2009-03-25 Thread Gary Herron
30\scripts\telnet.py File "c:\Python30\scripts\telnet.py", line 20 print tn.read_all() ^ SyntaxError: invalid syntax C:\Python30> There's the clue: In python 3.X, print is a function call print(tn.read_all() ) with lots of formatting and line-ending features In python 2.X, print

SyntaxError: invalid syntax (windows)

2009-03-25 Thread Python Newsgroup
ord: ") tn.write(password + "\n") tn.write("ls\n") tn.write("exit\n") print tn.read_all() Regardless of the script content, running in windows I constently get this SyntaxError: C:\Python30>python c:\Python30\scripts\telnet.py File "c:\Python30\

Re: Invalid syntax with print "Hello World"

2009-03-12 Thread Luis Zarrabeitia
On Thursday 12 March 2009 07:45:55 am Dotan Cohen wrote: > I do not think that is the best way to go about learning Python. Why > learn an arguably depreciating version when the new version is > available. Because it is not only the language that matters, you also need the libraries to accomplis

Re: Invalid syntax with print "Hello World"

2009-03-12 Thread Henrik Bechmann
On Mar 12, 7:45 am, Dotan Cohen wrote: > > Welcome to the list.  As a newbie myself, I ran into the Python3 vrs > > 2.6 issue.  May I suggest starting with 2.6?  There is many more books > > and internet stuff you can learn with in 2.6 - and the examples will > > work. As Garry wrote, once you und

Re: Invalid syntax with print "Hello World"

2009-03-12 Thread Paul Boddie
On 12 Mar, 12:45, Dotan Cohen wrote: > [starting with 2.6] > I do not think that is the best way to go about learning Python. Why > learn an arguably depreciating version when the new version is > available. I agree that there are not many tutorial written for Python > 3 however there are enough

Re: Invalid syntax with print "Hello World"

2009-03-12 Thread Dotan Cohen
> Welcome to the list.  As a newbie myself, I ran into the Python3 vrs > 2.6 issue.  May I suggest starting with 2.6?  There is many more books > and internet stuff you can learn with in 2.6 - and the examples will > work. As Garry wrote, once you understand 2.6, 3.0 will not be a > challenge. > I

Re: Invalid syntax with print "Hello World"

2009-03-12 Thread steven.oldner
On Mar 12, 2:25 am, John Machin wrote: > On Mar 12, 5:57 pm, Henrik Bechmann wrote: > > > obviously total mewbiew: > > > My first program in Python Windows > > What is that you are callind "Python Windows"? What version of Python > are you running? > > 2.X: print "Hello World" > should work. > >

Re: Invalid syntax with print "Hello World"

2009-03-12 Thread John Machin
On Mar 12, 5:57 pm, Henrik Bechmann wrote: > obviously total mewbiew: > > My first program in Python Windows What is that you are callind "Python Windows"? What version of Python are you running? 2.X: print "Hello World" should work. 3.X: print is now a function, print("Hello World") should wor

Re: Invalid syntax with print "Hello World"

2009-03-12 Thread Daniel Fetchinson
> obviously total mewbiew: > > My first program in Python Windows > > print "Hello World" > > I select Run/Run Module and get an error: > > Syntax error, with the closing quote highlighted. > > Tried with single quotes as well. Same problem. > > Can someone explain my mistake? Are you using python

  1   2   >