I have a script that when I run it from pycharm, it runs fine, but when executed from the command line it complains
import util as u
ModuleNotFoundError: No module named 'util'
I followed this advice here: Script running in PyCharm but not from the command line
Interpreter is the same, working directory is the same, but sys paths are different.
The module's folder looks like this
mymodule
sub_1
util.py
sub_2
...
main.py
pycharm shows all folders when printing sys.path elements. when running from the command line, it doesn't show any of them, even when I run it from thr director where main.py
is.
Do I have to add the directory to PYTHONPATH
even when I run the file from that directory? Seems like overkill having every project's directory added. Is there a better way to do this or is that the standard procedure?