So I have this simple program, job_admin_cli.py:
import pyhocon
import sys
print(sys.path)
When I execute it, I get the following result
myapptest-staging-dark-3 33.5.0-jscherman /opt/myapptest/staging/myapptest $ sudo python3 job_admin_cli.py
['/opt/myapptest/staging/myapptest', '/usr/lib/python36.zip', '/usr/lib/python3.6', '/usr/lib/python3.6/lib-dynload', '/usr/local/lib/python3.6/dist-packages', '/usr/lib/python3/dist-packages']
Traceback (most recent call last):
File "/opt/myapptest/staging/myapptest/job_admin_cli.py", line 1, in <module>
import pyhocon
ModuleNotFoundError: No module named 'pyhocon'
On the other side, when doing exactly the same from the console,
myapptest-staging-dark-3 33.5.0-jscherman /opt/myapptest/staging/myapptest $ python3
Python 3.6.10 |Anaconda, Inc.| (default, Jan 7 2020, 21:14:29)
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pyhocon
>>>
>>> import sys
>>> print(sys.path)
['', '/opt/myapptest/staging', '/opt/myapptest/staging/miniconda3/envs/myapptest/lib/python36.zip', '/opt/myapptest/staging/miniconda3/envs/myapptest/lib/python3.6', '/opt/myapptest/staging/miniconda3/envs/myapptest/lib/python3.6/lib-dynload', '/opt/myapptest/staging/miniconda3/envs/myapptest/lib/python3.6/site-packages']
Note that, not only it can import now the pyhocon module, but it also prints different paths in sys.path.
Why is this happening?