I'm so sorry about this basic question, because it's similar to this: Stumped by relative imports
But I'm trying to follow the PEP328 http://www.python.org/dev/peps/pep-0328/#guido-s-decision and it doesn't work for me :(
These are my files:
dev@desktop:~/Desktop/test$ ls
controller.py __init__.py test.py
2to3 says all it's right:
dev@desktop:~/Desktop/test$ 2to3 .
RefactoringTool: Skipping implicit fixer: buffer
RefactoringTool: Skipping implicit fixer: idioms
RefactoringTool: Skipping implicit fixer: set_literal
RefactoringTool: Skipping implicit fixer: ws_comma
RefactoringTool: No files need to be modified.
The content of the files:
dev@desktop:~/Desktop/test$ cat controller.py
class Controller:
def __init__(self):
pass
dev@desktop:~/Desktop/test$ cat __init__.py
# -*- coding: utf-8 -*-
dev@desktop:~/Desktop/test$ cat test.py
#!/usr/bin/env python
from .controller import Controller
if __name__ == '__main__':
print('running...')
But the import it's not working:
dev@desktop:~/Desktop/test$ python3 test.py
Traceback (most recent call last):
File "test.py", line 2, in <module>
from .controller import Controller
ValueError: Attempted relative import in non-package
dev@desktop:~/Desktop/test$
Any help is appreciated! Thanks in advance!