[SciPy-user] RPM building trouble

Pearu Peterson pearu at scipy.org
Tue Oct 5 05:17:00 EDT 2004



On Tue, 5 Oct 2004, Prabhu Ramachandran wrote:

>>>>>> "PP" == Pearu Peterson <pearu at scipy.org> writes:
>
>    PP> On Tue, 5 Oct 2004, Michael Reimpell wrote:
>
> [snip]
>    PP> from scipy import plt import gui_thread gui_thread.start()
>    PP> plt.plot((1,2,3))
>
>    PP> works fine here.
>
> Yes, I am not sure why but plt does not import wxPython till plt.plot
> is called.  I checked sys.modules and wx is not to be seen.
>
> In [1]: from scipy import plt
> In [2]: import sys
> In [3]: [x for x in sys.modules.keys() if x.find('wx') > -1]
> Out[3]: []
>
> I guess its the special import stuff thats causing this?

Yes, notice that importing plt has been postponed:

In [4]: repr(plt)
Out[4]: "<module 'scipy.plt' from 
'/usr/local/lib/python2.3/site-packages/scipy/plt/__init__.py' [import postponed]>"

and once ipython is trying to access plt, wxPython will be imported:

In [5]: plt
Out[5]: <module 'scipy.plt' from 
'/usr/local/lib/python2.3/site-packages/scipy/plt/__init__.pyc' 
[imported]>
In [6]: len([x for x in sys.modules.keys() if x.find('wx') > -1])
Out[6]: 53

Pearu




More information about the SciPy-User mailing list