On Fri, Jul 10, 2009 at 09:41:30AM -1000, Eric Firing wrote:
>> OK, but right now MPL is broken with my version of wxversion, which is the
>> one shipped by default in Ubuntu. So it is broken for a lot of user.
>
> Are you sure?  Could you be pulling in some other wxversion?  The only  
> other person reporting this problem so far is Tony Yu. I am now on  
> jaunty, and my wxversion has AlreadyImportedError.  What version of  
> ubuntu are you using, and what is the full wx version that it includes?

Ha, interesting:

$ ipython   
Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41) 
Type "copyright", "credits" or "license" for more information.

IPython 0.10.bzr.r1163 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object'. ?object also works, ?? prints more.

In [1]: import wxversion

In [2]: wxversion.__file__
Out[2]: '/usr/lib/python2.6/dist-packages/wx-2.6-gtk2-unicode/wxversion.pyc'

So, if wx2.6 is installed (I have 2.8 installed too), we run into these
problem.

Also, it is interesting to see that the older wxversion gets imported.
That does defeat the purpose of wxversion :). It means that you can't
have multiple versions of wx installed.

>> It seems wrong for me to require the users to upgrade wxversion while
>> there is a solution that works, eventhough it may not be exactly what you
>> want.
>
> The solution you propose doesn't work.  It completely defeats the  
> version check.

In a way it does. So we can add a check:

"if 'wx' in sys.module:"

to replace the "AlreadyImportedError", it is clearly bug ware.

>> One solution is to do bugware with hasattr(wxversion, 'AlreadyImportedError')
>
> Committed to svn.  Please check it.

Certainly does work betters. Also, the "AlreadyImported" problem is
caught elsewhere if I preimport an older version of wx:

File "/home/varoquau/dev/matplotlib/lib/pylab.py", line 1, in <module>
    from matplotlib.pylab import *
  File "/home/varoquau/dev/matplotlib/lib/matplotlib/pylab.py", line 244,
in <module>
    from matplotlib.pyplot import *
  File "/home/varoquau/dev/matplotlib/lib/matplotlib/pyplot.py", line 76,
in <module>
    new_figure_manager, draw_if_interactive, show = pylab_setup()
  File
"/home/varoquau/dev/matplotlib/lib/matplotlib/backends/__init__.py", line
25, in pylab_setup
    globals(),locals(),[backend_name])
  File
"/home/varoquau/dev/matplotlib/lib/matplotlib/backends/backend_wxagg.py",
line 23, in <module>
    import backend_wx    # already uses wxversion.ensureMinimal('2.8')
  File
"/home/varoquau/dev/matplotlib/lib/matplotlib/backends/backend_wx.py",
line 137, in <module>
    raise ImportError(missingwx)
ImportError: Matplotlib backend_wx and backend_wxagg require wxPython >=2.8

Thanks for your fix.

Gaƫl

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time, 
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel

Reply via email to