[SciPy-user] Accessing modules in packages

Dave Bazell bazell at comcast.net
Tue Dec 17 07:43:52 EST 2002


OK, I got it.  I have been doing:

>>> from scipy.cluster import *
>>> vq.kmeans
        traceback...
        vq not defines...

There is no __all__ list defined in cluster/__init__.py so my statement does
not import vq.  I can import * from the vq package or explicitly import vq
from the cluster package and get to kmeans.

Thanks,

Dave
----- Original Message -----
From: "eric jones" <eric at enthought.com>
To: <scipy-user at scipy.net>
Sent: Monday, December 16, 2002 6:25 PM
Subject: RE: [SciPy-user] Accessing modules in packages


> Hey Dave,
>
> I'm not sure what is going on.  The following works for me:
>
> H:\tmp>python
> Python 2.2.1 (#34, Apr  9 2002, 19:34:33) [MSC 32 bit (Intel)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
> >>> from scipy.cluster.vq import *
> >>> kmeans
> <function kmeans at 0x01BF36E8>
>
> as does:
>
> H:\tmp>python
> Python 2.2.1 (#34, Apr  9 2002, 19:34:33) [MSC 32 bit (Intel)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
> >>> from scipy.cluster import vq
> >>> vq.kmeans
> <function kmeans at 0x01BF3FC0>
>
> Do these same commands fail for you?
>
> Regards,
> eric
>
> ----------------------------------------------
> eric jones                    515 Congress Ave
> www.enthought.com             Suite 1614
> 512 536-1057                  Austin, Tx 78701
>
>
> > -----Original Message-----
> > From: scipy-user-admin at scipy.net [mailto:scipy-user-admin at scipy.net]
> On
> > Behalf Of Dave Bazell
> > Sent: Monday, December 16, 2002 2:09 PM
> > To: scipy-user at scipy.net
> > Subject: [SciPy-user] Accessing modules in packages
> >
> > I am trying to use scipy.cluster.vq.kmeans.  I have imported scipy:
> >
> > > import scipy
> >
> > and tried cluster.vq.kmeans(..) but I get an error "no module vq in
> > cluster"
> > or something like that.
> >
> > I have tried
> >
> > from scipy import *
> > from scipy.cluster import *
> >
> > and
> >
> > from scipy.cluster.vq import *
> >
> > but none of these allow me to access cluster.vq.kmeans.
> >
> > If I copy the vq.py file to my working directory and do
> >
> > import vq
> >
> > then I can access it.
> >
> > What am I doing wrong?  I am sure this is a simple thing to answer and
> > displays my current (but decreasing) ignorance of python.
> >
> > Thanks,
> >
> > Dave Bazell
> >
> >
> >
> > _______________________________________________
> > SciPy-user mailing list
> > SciPy-user at scipy.net
> > http://www.scipy.net/mailman/listinfo/scipy-user
>
>
>
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at scipy.net
> http://www.scipy.net/mailman/listinfo/scipy-user





More information about the SciPy-User mailing list