From: Gabriel Genellina on
En Tue, 03 Nov 2009 12:29:10 -0300, Ask Solem <asksolem(a)>

> If you have a module named myapp.django, and someone writes a cool
> library called
> django that you want to use, you can't use it unless you rename your
> local django module.
> file myapp/
> from django.utils.functional import curry
> ImportError: No module named utils.functional
> At least that's what I get, maybe there is some workaround, some way
> to say this is an absolute path?

Yes, that's exactly the way to solve it. Either move on to Python 3, or
from __future__ import absolute_import

When absolute imports are in effect, and assuming your code is inside a
package, then neither "import re" nor "from django.utils.functional import
curry" are affected by your own module names, because those statements
imply an absolute import ("absolute" means that the module is searched
along sys.path).
The only way to import a local file "" is using "from .re import
something"; the leading dot means it's a relative import ("relative" means
that the module is searched in a single directory: the current package
directory and its parents, depending on how many dots are specified)

Gabriel Genellina

From: Mark Leander on
On Oct 31, 5:12 pm, kj <> wrote:
> I give up: what's the trick? (Of course, renaming ham/ is
> hardly "the trick." It's rather Procrustes' Bed.)

I realize that this is probably not the answer you were looking for,

$ python -m ham.spam


==> ./ <==
import ham.spam

$ python

I've found it easier to not fight the module/package system but work
with it. But yes, I also think the problem you're seeing is a wart or
bug even.

Best regards
Mark Leander