Problem with __init__.py in Python3.1

Hidura hidura at gmail.com
Thu Feb 4 10:40:41 EST 2010


Thanks, I read it and try to put my code in the correct form, but now give
me another error, inside the Writer Package says:
"ValueError: Attempted relative import in non-package", if somebody knows a
clue of how fix it i will glad to read opinions. [?]

On Thu, Feb 4, 2010 at 2:11 AM, Gabriel Genellina <gagsl-py2 at yahoo.com.ar>wrote:

> En Thu, 04 Feb 2010 01:00:56 -0300, Hidura <hidura at gmail.com> escribió:
>
>
>  Good evening list, I have a really big trouble with the imports in the 3.1
>> version(Notes: In the older 2.64 theres no problems), I have two packages,
>> the first package Utilities who contains Writer the second package,
>> Writers
>> contain the module tagmanip(What is imported in the best way inside the
>> __init__.py of the Writer), when i make  the import inside the writer
>> everything is ok, but from the Utilities package the errors says:
>> "ImportError: No module named tagsmanip".
>> I don't understand why this is happening, if somebody could help me i will
>> glad to hear any suggestion.
>>
>
> In Python 3.x, "absolute" import is enabled by default (2.6 uses a mix of
> relative and absolute imports).
> To import sibling modules in a package, or modules in a subpackage, you
> have to use relative imports:
>
> from . import tagmanip
> from .Writers import tagmanip
>
> See PEP328 http://www.python.org/dev/peps/pep-0328/
>
> --
> Gabriel Genellina
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>



-- 
Hidura
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20100204/414625c4/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 330.png
Type: image/png
Size: 611 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20100204/414625c4/attachment.png>


More information about the Python-list mailing list