Explicit relative import marked as error
Brought to you by:
fabioz
The following import is being marked as an error even though the code runs OK:
from .data.myusers import MyUserEntity
PyDev 2.2.1.2011071313
Eclipse 3.7.0
Windows 7 64-bit
It seems like I'm getting the same problem as in bug ID 3199805, here is the additional information you asked for there, the structure:
src/
__init__.py
data/
__init__.py
myusers.py
service/
__init__.py
users.py
The import line above is in users.py
If it's in users.py it should have been
from ..data.myusers import (...)
not
from .data.myusers import (...)
If I use the extra dot, like so:
from ..data.myusers import MyUserEntity
rather than
from .data.myusers import MyUserEntity
I get the following error in the console:
ValueError: Attempted relative import beyond toplevel package