Py3: Import relative path module

Gnarlodious gnarlodious at gmail.com
Mon Nov 1 11:54:31 CET 2010


On Nov 1, 2:16 am, Steven D'Aprano <steve-REMOVE-
T... at cybersource.com.au> wrote:
> On Mon, 01 Nov 2010 01:08:52 -0700, Gnarlodious wrote:
> > On Oct 31, 11:09 am, Дамјан Георгиевски wrote:
> >> from .. import Data.DumpHT as DumpHT
>
> > That doesn't work. Any more ideas?
>
> Define "doesn't work".

LOL.
I get error:

    from .. import Data.DumpHT as DumpHT
                       ^
SyntaxError: invalid syntax

Rewording gets me closer:

    from ..Data import DumpHT
ValueError: Attempted relative import in non-package

I do have the empty __init__.py file in the Data folder. What is
wrong?

-- Gnarlie





More information about the Python-list mailing list