0
I am with a proble, use Python 3.6.7 I am making a Flask application with the following structure:
/app /arquivospy consultaMercados.py definirMercados.py interfaceBD.py main.py outros arquivos py /static /templates app.py form.py
inside the /file folder has some py scripts that I use to read a TXT and register in the BD generate some media make an account and save in the BD have BD query scripts, have the main.py file that I use in the same shell, it has a little menuzinho that I inform the name of the TXT file and it automates everything, IE inside the folder /file ta everything working fine.
The problem is with app.py that makes the Flask routes, it matters:
import arquivospy.interfaceBD and this error:
File "app.py", line 7, in import arquivospy.interfaceBD File "/home/karont/SiteHtml/app/arquivospy/interfaceBD.py", line 2, in import definirMercados as mercados ModuleNotFoundError: No module named 'definirMercados'
In the archive
interfaceBD
placeimport . definirMercados
with the point to leave the relative import path.– Woss
if you do this from the invalid syntax error
– Stefano Emmanuel
Yes, for a moment I read that you were using the
from .definirMercados import ...
, only with theimport
doesn’t work at all. So put the full import path:import arquivospy.definirMercados as mercados
– Woss
If I do this the app.py works the plication wheel do everything right in the Browser, but if you need to use main.py to register new things, then error have to remove all the import files. in all py files that I have changed and put import definitionMercados the markets, ie have to go back to work looking for the same folder
– Stefano Emmanuel
You created the file
__init__.py
in the folders where each module is?– Camilo Santos
I’ve created a void with ALL = [file name.py] and I saw nothing spoken that from python 3.4 was not but accurate. problem ta in app.py call a module(interfaceBD.py) and this module do its job by interacting with its sister modules (within the same folder)
– Stefano Emmanuel
Ih, I haven’t seen the comments, :D You’re running your application from where, from which file in which directory?
– Gau