Forums

modulenotfounderror for my own python script

Im sure im doing something stupid, but I can't see the problem. I can run my app via python -m main.py and this works fine from the console. When I provide the same command, including path to the script, for an always on script, it gives an error "modulenotfounderror" for my own python script:

Mar 15 23:00:19 /home/reuscam/.local/bin/python: Error while finding module specification for '/home/reuscam/banambulance/BanambulanceBot/main.py' (ModuleNotFoundError: No module named '/home/reuscam/banambulance/BanambulanceBot/main'). Try using '/home/reuscam/banambulance/BanambulanceBot/main' instead of '/home/reuscam/banambulance/BanambulanceBot/main.py' as the module name.

I am not using a venv.

Take a look at https://help.pythonanywhere.com/pages/DebuggingImportError/

I can´t get the Test code because I have installed the modules with the pip command but when I run pytest-m connection command I get the error

tests\conftest.py:2: in from mflix.factory import create_app mflix\factory.py:6: in from flask_bcrypt import Bcrypt E ModuleNotFoundError: No module named ‘flask_bcrypt’t’

Maybe you run pytest in other environment/python version, not the one you installed packages for.