Connect to an URI in postgres

0 votes

When I am using the following command:

import psycopg2

It is giving the following error:

psycopg2.OperationalError: missing "=" after
"postgresql://postgres:postgres@localhost/postgres" in connection info string

Can anyone tell me why? How do I fix this?

Jul 29 in Python by ana1504.k
• 7,890 points

1 answer to this question.

0 votes
The connection string passed to psycopg2.connect is not parsed by psycopg2: it is passed verbatim to libpq.

Hope this helps!
answered Jul 29 by SDeb
• 13,210 points

Related Questions In Python

+4 votes
7 answers
0 votes
1 answer

Connect to a MySQL DB in python?

db = MySQLdb.connect(host="localhost", # ...READ MORE

answered Jul 20, 2018 in Python by Nietzsche's daemon
• 4,260 points
+1 vote
1 answer

How to print an error in Python?

For Python 2.6 and later and Python ...READ MORE

answered Aug 23, 2018 in Python by Priyaj
• 57,300 points
0 votes
1 answer

How to create transaction in GnuCash in response to an email?

Here's a template, along with a couple ...READ MORE

answered Sep 5, 2018 in Python by Priyaj
• 57,300 points
+1 vote
2 answers

how can i count the items in a list?

Syntax :            list. count(value) Code: colors = ['red', 'green', ...READ MORE

answered Jul 6 in Python by Neha
• 330 points

edited Jul 8 by Kalgi 417 views
0 votes
1 answer

Is arr.__len__() the preferred way to get the length of an array in Python?

my_list = [1,2,3,4,5,6,7] len(my_list) # 7 The same works for ...READ MORE

answered Oct 8, 2018 in Python by SDeb
• 13,210 points
0 votes
1 answer

Convert HTML to an image in Python

webkit2png. The original version is OSX-only, but luckily ...READ MORE

answered Feb 4 in Python by SDeb
• 13,210 points