I'm trying to connect to a postgres database with psycopg2:
def get_posts():
db = psycopg2.connect(database=DBNAME)
c = db.cursor()
Which returns:
File "/vagrant/forum/solution/forumdb_solved.py", line 9, in get_posts
db = psycopg2.connect(database=DBNAME)
AttributeError: 'module' object has no attribute 'connect'
I have researched other solutions to this problem (Psycopg2: 'module' object has no attribute 'connect'). None of my folder/file structure contains psycopg2 though. The other issue which seems to come up is read/write privileges of the folder in which psycopg2 is installed. I have psycopg2 installed in multiple locations (don't ask!) and not sure how to check this. Any help would be appreciated by a total newbie.