I create a Python project using Flask and it works perfectly. Then I upload it to my private Azure repository. After that, another coworker clone the project and try to run in his machine, but it didn't work. He got the following error:
File "run.py", line 1, in <module>
from api import app
File "E:\PUC_Conexao_Colaborativa_API\api\__init__.py", line 7, in <module>
from api.instance.config import app_config, ambiente
ModuleNotFoundError: No module named 'api.instance'
I look on Stackoverflow and found this post: Python error "ImportError: No module named"
One of the answer say that:
- You edited init.py on windows.
- The windows editor added something non-printing, perhaps a carriage-return (end-of-line in Windows is CR/LF; in unix it is LF only), or perhaps a CTRL-Z (windows end-of-file).
I remember when I install "Git for Windows" exe, it asks for how I want to config the line ending conversions and I select "Checkout Windows-style, commit Unix-style line endings".
Is this the cause that my Python project fails to run in another machines?
The project runs fine on my machine and I copy the entire project and give to the another coworker using a pendrive. When the coworker run the project using the files in the pendrive, it runs perfectly, just like in my machine.
But if I or anyone else try to run the project downloading it from the repository, if fails to run with the error that I mention above.
I suppose the error is caused by the conversion of Git when I push the project to the repo. If am I correct, how can I fix that?