On Sat, Sep 25, 2010 at 4:52 PM, Georg Brandl email@example.com wrote:
I wonder if situation with relative imports in packages is improved in Python 3k or we are still doomed to a chain of hacks?
My user story:
PEP 328 http://www.python.org/dev/peps/pep-0328/ proposes:
from ... import config from ..utils.qthelpers import translate, add_actions, create_action
But this doesn't work, and I couldn't find any short user level explanation why it is not possible to make this work at least in Py3k without additional magic.
Uh, "this doesn't work" is a report that every developer loves. I suppose Python does raise an exception with a message?
It is not a bug report. It is a "user story" - that means the thing that I, as a user of Python, assumed to work. But instead have got:
ValueError: Attempted relative import in non-package
There are __init__.py files in every directory of spyderlib, but I don't want to debug or seek a workarounds against this in Python 2. I just want to know if relative imports are fixed in Python 3.