En Thu, 04 Feb 2010 12:40:41 -0300, Hidura <hid...@gmail.com> escribió:

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. [?]

You say that Writer is a package, but apparently Python disagrees. A package is not just "a directory containing an __init__.py file", this is half the truth. Python must be *aware* of such file, and this happens when you import the package.

If you directly run a script from inside a package, Python does not know that it belongs to a package, and treats it as a simple, lonely script. In that case, relative imports won't work.

Put the "main" script (the one that you directly execute) outside the package. It can be as small as this, if you want:

from some.package import main
main()

--
Gabriel Genellina

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to