Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #71654 > unrolled thread
| Started by | dandrigo <laurent.celati@gmail.com> |
|---|---|
| First post | 2014-05-16 03:18 -0700 |
| Last post | 2014-05-19 22:21 -0700 |
| Articles | 2 — 2 participants |
Back to article view | Back to comp.lang.python
Psycopg2 : error message. dandrigo <laurent.celati@gmail.com> - 2014-05-16 03:18 -0700
Re: Psycopg2 : error message. Tim Roberts <timr@probo.com> - 2014-05-19 22:21 -0700
| From | dandrigo <laurent.celati@gmail.com> |
|---|---|
| Date | 2014-05-16 03:18 -0700 |
| Subject | Psycopg2 : error message. |
| Message-ID | <mailman.10065.1400235546.18130.python-list@python.org> |
Dear all, 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. Please read the 2 usefull files below : Dandrigo pg_test.py <http://python.6.x6.nabble.com/file/n5057062/pg_test.py> SS_dos.JPG <http://python.6.x6.nabble.com/file/n5057062/SS_dos.JPG> In advance, thank you to throw light for me. Regards. -- View this message in context: http://python.6.x6.nabble.com/Psycopg2-error-message-tp5057062.html Sent from the Python - python-list mailing list archive at Nabble.com.
[toc] | [next] | [standalone]
| From | Tim Roberts <timr@probo.com> |
|---|---|
| Date | 2014-05-19 22:21 -0700 |
| Message-ID | <adpln9tmcth512vqd0ljlt9cpt37hvm9m3@4ax.com> |
| In reply to | #71654 |
dandrigo <laurent.celati@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
documentation.
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
password=cactus")
or do this:
conn=psycopg2.connect(database='busard_test', user='laurent',
host='localhost', password='cactus'")
--
Tim Roberts, timr@probo.com
Providenza & Boekelheide, Inc.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web