[SciPy-user] help importing integrate

David M. Cooke cookedm@physics.mcmaster...
Mon Jun 11 15:17:27 CDT 2007


On Mon, Jun 11, 2007 at 01:09:19PM -0500, Trevis Crane wrote:
> Hi all,
> 
> I'm confused.  In my code I start with this:
> import scipy as S
> later on, I call odeint like so:
> Y = S.integrate.odeint(args)
> Yet, this doesn't seem to work (raising an AttributeError), and I can't
> figure out why.  It will work if I add:
> from scipy import integrate
> and call odeint like so:
> Y = integrate.odeint(args)
> but without that extra import line, I get an attribute error saying
> 'module' object has no attribute 'integrate'.  It would seem I am
> misunderstanding some aspect of scipy's structure or something even more
> basic.  Any help or clarification is appreciated.

The toplevel scipy package doesn't import subpackages, so you need to do

import scipy.integrate


-- 
|>|\/|<
/--------------------------------------------------------------------------\
|David M. Cooke                      http://arbutus.physics.mcmaster.ca/dmc/
|cookedm@physics.mcmaster.ca


More information about the SciPy-user mailing list