[Grok-dev] Re: The Mammoth-Herd Example
Martijn Faassen
faassen at startifact.com
Mon Sep 10 07:45:19 EDT 2007
Darryl Cousins wrote:
[snip]
> Perhaps not grok. Something somewhere some months previously pointed to
> a problem where the package and file name are the same. In your case
> 'herd'. I'm not sure that it was grok or even zope3 related but it did
> bite me in a grok application.
If I understand the problem right, it's actually a Python problem (!).
We got bit during tutorial I gave in Germany.
What happens is the following:
package foo
module foo
baz = "BAZ"
module bar
from foo import baz # fails!
What happens is that Python's import system does relative imports first.
This means that module bar is not importing package foo as expected, but
module foo instead.
In future versions of Python there's a way to explicitly force an
absolute import, which should solve this problem.
Regards,
Martijn
More information about the Grok-dev
mailing list