'utf-8' codec can't decode byte 0xc2 in position 55: invalid continuation byte
import psycopg2 as db
from config import host, user, password, db_name
try:
# connect to database
connection = db.connect(
host=host,
user=user,
password=password,
database=db_name
)
# execute cursor
with connection.cursor() as cursor:
cursor.execute(
"SELECT version();"
)
print(f"Server version: {cursor.fetchone()}")
except Exception as _ex:
print("[INFO] Error while working with PostgreSQL", _ex)
finally:
# if connection:
# connection.close()
print("[INFO] PostgreSQL connection closed")