[Python] cannot import name 'mydb' from partially initialized module 'connection' in Python

Discussão em 'Python' iniciado por Stack, Março 18, 2025.

  1. Stack

    Stack Membro Participativo

    Python 3.8 error

    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)


    When I tried to execute child module select.py

    import bcrypt;
    from connection import mydb


    That has an imported module connection.py

    import mysql.connector
    mydb = "Success";


    I don't know what is the problem. The error doesn't appear when I remove import mysql.connector from my module connection.py, but it does not solve my problem.

    > python -m select

    Continue reading...

Compartilhe esta Página