Improve absolute import management for

Bug #506112 reported by Fernando Perez on 2010-01-11
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Fernando Perez

Bug Description

On Mon, Jan 11, 2010 at 11:36 AM, Jörgen Stenarson <email address hidden> wrote:
> I often run IPython/testing/ as a script but this is not possible
> now due to a relative import:
> C:\python\external\ipython-perez\IPython>python testing\
> Traceback (most recent call last):
> File "testing\", line 39, in <module>
> from . import globalipapp
> ValueError: Attempted relative import in non-package

Argh, yes. This is unfortunately only fixed for 2.6:

We might just add that boilerplate

if __name__ == "__main__" and __package__ is None:
    __package__ = ""

protected by a version check, so your approach continues to work.

Changed in ipython:
assignee: nobody → Fernando Perez (fdo.perez)
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers