bezzoon
bezzoon

Reputation: 2019

no module named error python, is it on sys.path?

Okay, I am getting an error that is like no module named credentials

https://i.sstatic.net/g3qQo.png

I have a credentials.py file in that directory. I am sort of new to python and this is driving me nuts.

How can I debug this, or can anyone tell right off the bat what may be the problem?

Upvotes: 0

Views: 272

Answers (1)

Thomas Orozco
Thomas Orozco

Reputation: 55199

When you do python keep_backend/manage.py runserver, then your PYTHONPATH will not include the current directory. Instead, in will include the keep_backend directory.

Since credentials.py is in the current directory, it is not importable.


A workaround is manually adding the right folder to your PYTHONPATH

PYTHONPATH=`pwd`:$PYTHONPATH python keep_backend/manage.py runserver

But you should most likely rethink your directory structure here.

Upvotes: 2

Related Questions