Page 1 of 1

Der Name „mydb“ kann nicht aus dem teilweise initialisierten Modul „connection“ in Python importiert werden

Posted: 11 Jan 2025, 12:41
by Guest
Python 3.8-Fehler

Code: Select all

ImportError: cannot import name 'mydb' from partially initialized module 'connection'
(most likely due to a circular import) (C:\U
sers\Mark04\Documents\Python tutorial\databasing\connection.py)
Als ich versuchte, das untergeordnete Modul select.py auszuführen

Code: Select all

import bcrypt;
from connection import mydb
Das hat ein importiertes Modul „connection.py“

Code: Select all

import mysql.connector
mydb = "Success";
Ich weiß nicht, was das Problem ist. Der Fehler erscheint nicht, wenn ich „import mysql.connector“ aus meinem Modul „connection.py“ entferne, aber mein Problem wird dadurch nicht gelöst.

Code: Select all

> python -m select