[SciPy-user] help importing integrate

Steve Schmerler elcorto@gmx....
Mon Jun 11 19:03:15 CDT 2007

David M. Cooke wrote:
> 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

This is to reduce importing time. For interactive work, you can do

import scipy as S


ipython -p scipy


I love deadlines. I like the whooshing sound they make as they fly by. -- Douglas Adams

More information about the SciPy-user mailing list