dandrigo <laurent.cel...@gmail.com> wrote:
>I'm writing a python script for a web service. I have to connect to my
>postgres/postgis databases via Psycopg2. 
>I writed a little first script just to connect to my pg/postgis db and drop
>a test db. 
>But when i execute the python file, i have several error messages. 

Really, this wouldn't have been so hard to figure out if you had read the

     conn=psycopg2.connect("dbname='busard_test' user='laurent'
host='localhost' password='cactus'")

Psycopg2 has two ways to specify the parameters.  You can either do them as
individual Python parameters, in which case each parameter is a string that
needs to be quited, OR you can use a single connection string, in which
case you do NOT quote the individual parameters.

So, you can either do this:

    conn=psycopg2.connect("dbname=busard_test user=laurent host=localhost

or do this:

     conn=psycopg2.connect(database='busard_test', user='laurent',
host='localhost', password='cactus'")
Tim Roberts, t...@probo.com
Providenza & Boekelheide, Inc.

Reply via email to