[Zope] Another import doesn't find the module

Dylan Reinhardt zope@dylanreinhardt.com
28 May 2003 11:01:17 -0700


Go back and look a little closer at the difference between what I typed
and what you're using.

Both your examples attempt to import from directories, something you
simply can't do... at least not *this* way.  In Python, the word
"module" refers, typically, to a .py file.  You can't find a module
called FGDC because (according to your diagram) there isn't one.

Once you re-work import to import names from modules, I think you'll
have better luck.

HTH,

Dylan



On Wed, 2003-05-28 at 10:06, Stacy Roberts Ladnier wrote:
> I have tried both. The name of the class I am trying to import is 
> profile. So I put
>     from Products.Resources.FGDC import profile 
> and I get 'cannot import name profile'
> 
> When I try 
>     from Products.Resources.FGDC import * 
> I get 'no module named FGDC'. But I promise there is and there is a 
> __init__ file there this time. This module is used from many other 
> parts in my product.
> 
> I have the PYTHONPATH right and an __init__ in both the FGDC and 
> extensions folders. I am at a loss for what is happening here.
> 
> Any help is appreciated, this is the last task before deployment.
> 
> Stacy
> 
> 
> 
> ----- Original Message -----
> From: Dylan Reinhardt <zope@dylanreinhardt.com>
> Date: Wednesday, May 28, 2003 10:38 am
> Subject: Re: [Zope] Another import doesn't find the module
> 
> > This is a different problem.  I think what you want is:
> > 
> > import * from Products.Resources.FGDC.profile
> > 
> > or 
> > 
> > from Products.Resources.FGDC.profile import NAMES_GO_HERE
> > 
> > HTH,
> > 
> > Dylan
> > 
> > 
> > On Wed, 2003-05-28 at 07:33, Stacy Roberts Ladnier wrote:
> > > I am attempting to import another class for use and Zope now 
> > > complains 'cannot import name profile'.
> > > 
> > > 
> > > My Product structure in a bit more detail is:
> > > 
> > > Products
> > >   - Resources
> > >      -FGDC
> > >          -__init__.py
> > >          -profile.py
> > >      -BIO
> > >      -scripts
> > >         -script1.py
> > >      -dtml
> > >      -www
> > >      -extensions
> > >         -DISTINFO.py which contains a class of the same name
> > > 
> > > In DISTINFO.py, I have an import statement like this:
> > >        from Products.Resources.FGDC import profile
> > > 
> > > Can someone please tell me what I am doing wrong here??
> > > 
> > > Thanks in advance,
> > > Stacy
> > > 
> > > 
> > > 
> > > 
> > > _______________________________________________
> > > Zope maillist  -  Zope@zope.org
> > > http://mail.zope.org/mailman/listinfo/zope
> > > **   No cross posts or HTML encoding!  **
> > > (Related lists - 
> > >  http://mail.zope.org/mailman/listinfo/zope-announce
> > >  http://mail.zope.org/mailman/listinfo/zope-dev )
> > 
> > 
> 
> 
> _______________________________________________
> Zope maillist  -  Zope@zope.org
> http://mail.zope.org/mailman/listinfo/zope
> **   No cross posts or HTML encoding!  **
> (Related lists - 
>  http://mail.zope.org/mailman/listinfo/zope-announce
>  http://mail.zope.org/mailman/listinfo/zope-dev )