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
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@scipy.net [mailto:scipy-user-admin@scipy.net] On Behalf Of Dave Bazell Sent: Monday, December 16, 2002 2:09 PM To: scipy-user@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@scipy.net http://www.scipy.net/mailman/listinfo/scipy-user
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@enthought.com> To: <scipy-user@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@scipy.net [mailto:scipy-user-admin@scipy.net] On Behalf Of Dave Bazell Sent: Monday, December 16, 2002 2:09 PM To: scipy-user@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@scipy.net http://www.scipy.net/mailman/listinfo/scipy-user
_______________________________________________ SciPy-user mailing list SciPy-user@scipy.net http://www.scipy.net/mailman/listinfo/scipy-user
We should add the __all__ statement -- I'll do it. Also, I'd be interested in feedback on the vq stuff. As far as I know, I'm the only one who has used it much -- and only for one application. Ideas about how to make it more flexible for other people's problems are welcome. Thanks, eric ---------------------------------------------- eric jones 515 Congress Ave www.enthought.com Suite 1614 512 536-1057 Austin, Tx 78701
-----Original Message----- From: scipy-user-admin@scipy.net [mailto:scipy-user-admin@scipy.net] On Behalf Of Dave Bazell Sent: Tuesday, December 17, 2002 6:44 AM To: scipy-user@scipy.net Subject: Re: [SciPy-user] Accessing modules in packages
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@enthought.com> To: <scipy-user@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@scipy.net [mailto:scipy-user-admin@scipy.net] On Behalf Of Dave Bazell Sent: Monday, December 16, 2002 2:09 PM To: scipy-user@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@scipy.net http://www.scipy.net/mailman/listinfo/scipy-user
_______________________________________________ SciPy-user mailing list SciPy-user@scipy.net http://www.scipy.net/mailman/listinfo/scipy-user
_______________________________________________ SciPy-user mailing list SciPy-user@scipy.net http://www.scipy.net/mailman/listinfo/scipy-user
We should add the __all__ statement -- I'll do it. OK, sounds reasonable.
Also, I'd be interested in feedback on the vq stuff. As far as I know, I'm the only one who has used it much -- and only for one application. Ideas about how to make it more flexible for other people's problems are welcome.
I am working on a project involving clustering of astronomical data. I will test it out over the next few weeks. I also plan to add some additional functionality to the clustering for my own project. I assume this can be incorporated into scipy if it meets the standards, which are published on the scipy website.
Thanks, eric
Thank you, Dave
We should add the __all__ statement -- I'll do it. OK, sounds reasonable.
Done.
Also, I'd be interested in feedback on the vq stuff. As far as I
know,
I'm the only one who has used it much -- and only for one application. Ideas about how to make it more flexible for other people's problems are welcome.
I am working on a project involving clustering of astronomical data. I will test it out over the next few weeks. I also plan to add some additional functionality to the clustering for my own project. I assume this can be incorporated into scipy if it meets the standards, which are published on the scipy website.
Absolutely. I look forward to your submissions. Thanks, eric
participants (2)
-
Dave Bazell -
eric jones