Unable to import module 'testdb': No module named 'psycopg2._psycopg' #28339
Unanswered
bkrishnaiah
asked this question in
Q&A
Replies: 1 comment
-
Hello, @bkrishnaiah. I'm not sure about your Python version. If this tool doesn't support your version, using Docker would be a good alternative. Below is a solution using Docker (in this example, I use Python 3.9):
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
I am trying to create a lambda function where I can have Postgres DB connection with AWS RDS. I am using the tech stack as python and aws cdk.
I have installed psycopg2-binary library to enable the DB connection. I have deployed this lambda function to AWS environment. But while testing the lambda in AWS console, I am getting below error. Could someone help me on this.
For reference,
————————
import psycopg2
connection = psycopg2.connect(
host=db_host,
user=user_name,
password=user_password,
database=dbname
)
Error Message:
—————————
{
"errorMessage": "Unable to import module 'testdb': No module named 'psycopg2._psycopg'",
"errorType": "Runtime.ImportModuleError",
"requestId": "593f9067-he23-4a54-b7773-39acdb2cd723",
"stackTrace": []
}
Thanks in advance..!!!
Beta Was this translation helpful? Give feedback.
All reactions