Py3: Import relative path module

Gnarlodious gnarlodious at gmail.com
Wed Nov 3 09:05:43 EDT 2010


On Nov 3, 2:51 am, Peter Otten wrote:

> Slightly generalized: have the importing module print its __name__. There
> has to be at least one dot in the name for
>
> from .. import whatever
>
> to succeed.

Just spent about 3 hours trying every permutation I could think of,
and searching Google for exactly how to do it, but all I get is:

ValueError: Attempted relative import in non-package

How do I import a module so that a dot will appear in its name?

-- Gnarlie



More information about the Python-list mailing list