If you run a python script as
python dir_name/script.py
... then python will execute the file named script.py
inside the folder dir_name
. What will happen here is python program will go inside dir_name
folder first and then run the script.
In your case if you type python flight_genie/main.py
, it will go inside the folder flight_genie
and will execute the file. Then python can't find a folder (actually the module) named flight_genie
there because python program is already inside that folder. That's why you get this error.
So one way of fixing this issue is replacing all import flight_genie.xxxx
with just import xxxx
. (Also from flight_genie.xxxx import yyyy
with from xxxx import yyyy
)
But it is so time consuming if you have a large project. (And sometime it won't even work). So best way is to run the project as a whole module.
If you look at here you can see how to run python modules as scripts. You just have to type the following command in console.
python -m flight_genie.main
ps: I assume that you have python3
installed in windows and configured to run python3
when you type python
in command line.