Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cant use psycopg2 and psycopg2 - binary on python 3.13.1 #1764

Closed
OmriTurgeman100 opened this issue Dec 13, 2024 · 1 comment
Closed

cant use psycopg2 and psycopg2 - binary on python 3.13.1 #1764

OmriTurgeman100 opened this issue Dec 13, 2024 · 1 comment

Comments

@OmriTurgeman100
Copy link

OmriTurgeman100 commented Dec 13, 2024

hey, I noticed that I can't use psycop2 in my rest api any more, I installed it on a new pc and when I run i get this error:

PS C:\Users\arch\OneDrive\desktop\monitoring-system-backend> & C:/Users/arch/AppData/Local/Programs/Python/Python313/python.exe "c:/Users/arch/OneDrive/desktop/monitoring-system-backend/app.py"
Traceback (most recent call last):
File "c:\Users\arch\OneDrive\desktop\monitoring-system-backend\app.py", line 4, in
from psycopg2.extras import RealDictCursor
File "C:\Users\omrig\AppData\Local\Programs\Python\Python313\Lib\site-packages\psycopg2_init_.py", line 51, in
from psycopg2._psycopg import ( # noqa
...<10 lines>...
)
ImportError: DLL load failed while importing _psycopg: The specified module could not be found.

this is my code if helpful:

from flask import Flask, jsonify, request
import json
from flask_cors import CORS
from psycopg2.extras import RealDictCursor
from datetime import datetime, timedelta
import psycopg2
from constants import DB_HOST, DB_NAME, DB_USER, DB_PASS
from threading import Thread
from multiprocessing import Process
from werkzeug.serving import WSGIRequestHandler
import logging
import time

app = Flask(name)

CORS(app)

def get_db_connection(): # * config
try:
postgres = psycopg2.connect(
host=DB_HOST,
database=DB_NAME,
user=DB_USER,
password=DB_PASS
)
return postgres

except Exception as e:
    print(e)
@dvarrazzo
Copy link
Member

#1736

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants