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

>>> %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: 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: 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: print 'hello' -> SyntaxError: invalid syntax

2008-02-08 Thread ValdezDE
On Feb 7, 10:21 pm, ajaksu <[EMAIL PROTECTED]> wrote: > On Feb 7, 12:52 pm, [EMAIL PROTECTED] wrote: > > > I try to install Python in a Dell D620 with XP PRO version 5.1.2600 > > and I am getting this error. I assume that some dlls are missing but I > > installed form a fresh python-2.5.1.msi with

Re: print 'hello' -> SyntaxError: invalid syntax

2008-02-07 Thread ajaksu
On Feb 7, 12:52 pm, [EMAIL PROTECTED] wrote: > I try to install Python in a Dell D620 with XP PRO version 5.1.2600 > and I am getting this error. I assume that some dlls are missing but I > installed form a fresh python-2.5.1.msi without errors msg. > > Thanks > > Roberto What is the install path

Re: print 'hello' -> SyntaxError: invalid syntax

2008-02-07 Thread Jon "Fluffy" Saul
On Feb 7, 2008 8:52 AM, <[EMAIL PROTECTED]> wrote: > I try to install Python in a Dell D620 with XP PRO version 5.1.2600 > and I am getting this error. I assume that some dlls are missing but I > installed form a fresh python-2.5.1.msi without errors msg. > > Thanks > > Roberto > > Sounds like a

print 'hello' -> SyntaxError: invalid syntax

2008-02-07 Thread ValdezDE
win32 Type "help", "copyright", "credits" or "license" for more information. >>> import this File "", line 1 import this ^ SyntaxError: invalid syntax >>> 2 + 2 File "", line 1 2 + 2

Re: SyntaxError: Invalid Syntax.

2006-11-10 Thread John Machin
n, and someone with mysqldb installed could try to reproduce your problem. > > exact error message: SyntaxError: Invalid Syntax Inexact! The message would have been SyntaxError: invalid syntax Please *DON'T* type in what you think you remember you think you saw on the screen; *COPY/PAS

Re: SyntaxError: Invalid Syntax.

2006-11-10 Thread Steve Holden
ronrsr wrote: > the syntax error comes in the main program, in any line that follows > the import statement. > in which case, don't you think it might be the "import" statement that's causing the problem. What is stopping you from showing us the whole source? Or at least the import statement as

Re: SyntaxError: Invalid Syntax.

2006-11-10 Thread Fredrik Lundh
s code to be compiled. > exact error message: SyntaxError: Invalid Syntax a complete syntax error usually includes a traceback: Traceback (most recent call last): File "program.py", line 1, in import module File "module.py", line 25 if 1 ^ SyntaxE

Re: SyntaxError: Invalid Syntax.

2006-11-10 Thread ronrsr
the syntax error comes in the main program, in any line that follows the import statement. ronrsr wrote: > the exact code that is triggering the error message is: > > zc = zsql.connect() > > > exact error message: SyntaxError: Invalid Syntax > > > but any statem

Re: SyntaxError: Invalid Syntax.

2006-11-10 Thread ronrsr
the exact code that is triggering the error message is: zc = zsql.connect() exact error message: SyntaxError: Invalid Syntax but any statement that follows the import statement will trigger it. bests, r-sr- Roberto Bonvallet wrote: > ronrsr wrote: > > thanks for the spee

Re: SyntaxError: Invalid Syntax.

2006-11-10 Thread Roberto Bonvallet
ronrsr wrote: > thanks for the speedy answer. what i meant was: > > return MySQLdb.connect (host = "db91b.pair.com", > user = "homebase", >passwd = "Newspaper2", >db = "homebase_zingers" > );

Re: SyntaxError: Invalid Syntax.

2006-11-10 Thread ronrsr
thanks for the speedy answer. what i meant was: return MySQLdb.connect (host = "db91b.pair.com", user = "homebase", passwd = "Newspaper2", db = "homebase_zingers" ); but even when I have

Re: SyntaxError: Invalid Syntax.

2006-11-10 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, ronrsr wrote: > def connect(): > > >return = MySQLdb.connect (host = "db91x..com", ^ You can't assign to a keyword. Just leave this ``=`` out. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

Re: SyntaxError: Invalid Syntax.

2006-11-10 Thread ronrsr
here's some of the surrounding code from the main program: querystring = querystring + " ORDER BY keywords "; #SQL import zsql zc = zsql.connect() print("return from open") zq = zc.query(querystring).dictresult() ronrsr wrote: > no matter where I place this imported file,the statement

Re: SyntaxError: Invalid Syntax.

2006-11-10 Thread Roberto Bonvallet
ronrsr wrote: > return = MySQLdb.connect (host = "db91x..com", > user = "", >passwd = "x", >db = "homebase_zingers" > ); return is a reserved keyword. You cannot have a variable

SyntaxError: Invalid Syntax.

2006-11-10 Thread ronrsr
no matter where I place this imported file,the statement after it in the main program gets a syntax error, regardless of the syntax. I think I may have changed something in this file, but I'm stuck. Can anyone help? #!/usr/local/bin/python # Copyright 2004 by Stephen Masterman #Change the db co

Re: SyntaxError: invalid syntax

2005-12-27 Thread Terry Hancock
On Tue, 27 Dec 2005 09:32:18 GMT "DIBS" <[EMAIL PROTECTED]> wrote: > >>> python sudoku.py > File "", line 1 >python sudoku.py > ^ > > >>>SyntaxError: invalid syntax > > Thanks for your help. &g

Re: SyntaxError: invalid syntax

2005-12-27 Thread Fredrik Lundh
"DIBS" <[EMAIL PROTECTED]> wrote: > >>> python sudoku.py > File "", line 1 >python sudoku.py > ^ > > >>>SyntaxError: invalid syntax > Thanks for your help. > The above is the extact message. th

Re: SyntaxError: invalid syntax

2005-12-27 Thread DIBS
>>> python sudoku.py File "", line 1 python sudoku.py ^ >>>SyntaxError: invalid syntax Thanks for your help. The above is the extact message. DIBS "Steven D'Aprano" <[EMAIL PROTECTED]> wrote in message news

Re: SyntaxError: invalid syntax

2005-12-27 Thread Fredrik Lundh
Steven D'Aprano wrote: > Please post the *full* traceback of the error, not just the last > description. > > For example, something like this: > > >>> x = x+*9 > File "", line 1 > x = x+*9 > ^ > SyntaxError: invalid syntax &

Re: SyntaxError: invalid syntax

2005-12-27 Thread Steven D'Aprano
On Tue, 27 Dec 2005 07:40:12 +, DIBS wrote: > I'm new to Python and I don't understand what I'm doing wrong. > > I'm running windows xp. > > In the command line window, I type: > Python Sudoku.py > > and I get the response" > > Synt

SyntaxError: invalid syntax

2005-12-26 Thread DIBS
I'm new to Python and I don't understand what I'm doing wrong. I'm running windows xp. In the command line window, I type: Python Sudoku.py and I get the response" SyntaxError: invalid syntax If anyone cane help me I'd be very grateful. -- http://mail.pyth