1
I have three . py files in my directory: Banco.py
, app.py
, Usuarios.py
.
My app.py
contains the Tkinder import that I am using in the code and here I start all my view and in it I import the class Usuarios.py
as follows:
#Arquivo app.py
from .Usuarios import *
from tkinter import *
class Application:
def __init__(self, master=None):
In the archive Usuario.py
contains all SQL executions for Insert, delete, update and select, and in that file import the file Banco.py
, follow:
#Arquivo Usuarios.py
from .Banco import Banco
class Usuarios():
def __init__(self, idusuario=0, nome="", telefone="", email="", usuario="", senha="" ):
Then in the Bank file just give the import in sqlite for its use, follows:
#Arquivo Banco.py
import sqlite3
class Banco():
def __init__(self):
The problem arises when running the app.py which returns me the following error error:
/usr/bin/python3.6 "/home/owi/Documents/Pycharmprojects/Tkinder examples/app.py" Traceback (Most recent call last): File "/home/owi/Documents/Pycharmprojects/Tkinder examples/app.py", line 1, in from . Users import * Modulenotfounderror: No module named 'main.Users'; 'main' is not a package
Process finished with Exit code 1
I would like to understand which problem related to the main is not correct since all classes contain def __ini__
.
It remained to say that by doing this - of putting the project in a package, the AP syntax, of importing the files prefixing them with a "." will now work.
– jsbueno