Try putting quotes around the database password.

----------------------------------------
From: "Boubacar Bah" <bahbouba....@gmail.com>
Sent: 9/17/21 1:22 PM
To: mapserver-users@lists.osgeo.org
Subject: [mapserver-users] asking help about python except databsaseError 
syntaxe

Hi everyone
currently I am on a python script in the I am using the psycopg2 to connect to 
a database
now at con = none
I try to connect to my database and make an insertion in my postgis database 
after this request I try to manage the except in case of error; This is where 
the script is problematic then the day of apache error says that the except 
synstax has an error but after having this several times I can't find the 
problem. below I send you the script and error log if someone can help me solve 
the problem.this is my script cgi:
con = None
try:
con = psycopg2.connect(host="localhost", database="webmapping", 
user="postgres", password=97071884)
cur = con.cursor()
cur.execute("insert into points(geom) values((SELECT 
ST_GeometryFromText('POINT(%s %s)',4326)))",(coordx,coordy,))
con.commit()
except psycopg2.DatabaseError, e:
print("Error %s") % e
sys.exit(1)
finally:
if con:
con.close()
this is my log error bellow:
[Thu Sep 16 20:52:16.176534 2021] [cgi:error] [pid 2852:tid 1232] [client 
::1:59242] AH01215:   File "C:\\ms4w\\Apache\\cgi-bin\\suivi_gps.cgi", line 
32\r: C:/ms4w/Apache/cgi-bin/suivi_gps.cgi
[Thu Sep 16 20:52:16.176534 2021] [cgi:error] [pid 2852:tid 1232] [client 
::1:59242] AH01215:     except psycopg2.DatabaseError, e:\r: 
C:/ms4w/Apache/cgi-bin/suivi_gps.cgi
[Thu Sep 16 20:52:16.176534 2021] [cgi:error] [pid 2852:tid 1232] [client 
::1:59242] AH01215:                                  ^\r: 
C:/ms4w/Apache/cgi-bin/suivi_gps.cgi
[Thu Sep 16 20:52:16.176534 2021] [cgi:error] [pid 2852:tid 1232] [client 
::1:59242] AH01215: SyntaxError: invalid syntax\r: 
C:/ms4w/Apache/cgi-bin/suivi_gps.cgi
if someone can suppose me idea to solve this problem
thanks
_______________________________________________
MapServer-users mailing list
MapServer-users@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/mapserver-users

Reply via email to