I understand that relative import has to be explicit in python 3, but i can't figure this one out.
I have one directory called work and files main.py and gmail.py
In main.py, I used to have "import gmail" in python 2
I just used 2to3, and this line was changed to "from . import gmail"
user@ubuntu:~/work$ python main.py
Traceback (most recent call last):
File "main.py", line 7, in <module>
from . import gmail
ImportError: cannot import name 'gmail'
What am I doing wrong?
By the way, when I do "python gmail.py", it works fine.
$ cat main.py
from . import gmail
$ cat gmail.py
print('test')
====================================== Ok I found that this works $ cat main.py import gmail
So why did 2to3 change this to something that does not work? And why do people say use "from . import gmail" when actually "import gmail" works?