[Zope] Another import doesn't find the module

Passin, Tom tpassin@mitretek.org
Wed, 28 May 2003 15:54:23 -0400


[Dylan Reinhardt]

> On Wed, 2003-05-28 at 11:37, Passin, Tom wrote:
> > [ Dylan Reinhardt]
> > > Either way, the thing you import or import from should be=20
> a module. =20
> > >=20
> >=20
> > No, you can also import names directly from a package - as=20
> long as they
> > are defined in the __init__.py. =20
>=20
> Neat.  I hadn't done it that way before, but it makes sense.=20
> A rare case
> in Python where there *is* more than one correct way to do it. :-)
>=20
> Taking this the next step, would you suspect that the O.P.'s=20
> problem is
> that one name is assigned in __init__.py and the other isn't?
>=20

No, I bet that the __init__.py file is empty.  I think there is an error
in the file that fails to import - bad indentation or something simple
like that.  That is usually what causes failed imports, and I notice
that you usually do not get a helpful error message to tell you that.

Also, it would be a good idea to stop Zope and restart it after making
whatever  changes, just in case (I am not sure about whether you need to
do this with products, but it would be worth trying).

I try to make all my modules  self-checking using a __main__ routine,
just so I can make sure they really compile and run, including all the
imports.  Makes life much simpler.

Cheers,

Tom P