I have two Python files, one stored in the location /Python/plata.py, and another in the location /Python/tao/mock.py. This is what my plata.py file looks like::
def printSomething(): print 'This is a test.' I'm trying to import the printSomething() function inside my mock.py file as follows:
from . import plata plata.printSomething() However, this is the error I'm encountering:
Traceback (most recent call last): File "/home/manas/Python/tao/mock.py", line 1, in <module> from . import plata ValueError: Attempted relative import in non-package I've included the __init__.py files in locations /Python/__init__.py and /Python/tao/__init__.py as well. However, I'm still encountering the same error.
What seems to be wrong here?
mock.pydirectly (as opposed to importing it from somewhere else)?