I have a folder with the following layout:
root/
package0/
__init__.py
main.py
package1/
__init__.py
main.py
Inside the package1/main.py
I have import package0
.
When I open a terminal on root
folder and run python package1/main.py
it works fine. But this is very strange since the cwd was not supposed to be included in path, only the folder in which the script is in, package1
in this case.
When I print the sys.path
I can see that the root folder is there.
When I run the same code on my other computer I get a import error as expected.
I cannot understand why I am seeing this behavior. I have already checked .bashrc and there is no code adding the cwd to the python path. What might be different on the two computers, I am transferring the root folder from one computer to another through git.