Postingan lainnya
saya punya sedikit masalah dengan importing data dari script local
Struktur directory:
image.pngNah dari file login.py saya coba buat mengakses connector.py pake import seperti biasanya:
from db.connector import *
import psycopg2 as pg
from UI.login_ui import *
cursor = connection
def lin(user = None,password = None):
cursor.execute("SELECT * FROM selector_user (%(usr)s, %(pw)s)",{'usr':user,'pw':password})
with cursor:
print("Connecting to account\n")
try:
print("Succesfully Connected to:")
row = cursor.fetchone()
print(f'{row[1]}')
except:
print("Error, cannot find the account")
tapi pas di coba jadinya:
Traceback (most recent call last):
File "c:\Users\folder a\folder b\Codingan\P1\pyt\UI\login.py", line 1, in <module>
from db.connector import *
ModuleNotFoundError: No module named 'db'
dan begitulah pas nyoba nyari di internet malah kurang faham musti gimana
0
1 Jawaban:
<div>Pertanyaannya apakah si db sudah di innstall? coba cek dahulu</div>
0