From: Fernando P. <fpe...@gm...> - 2010-08-25 21:58:18
|
Hi folks, I'd like to know if the fix below looks reasonable to you, this is a diff against current svn trunk: dreamweaver[matplotlib]> svn diff Index: __init__.py =================================================================== --- __init__.py (revision 8656) +++ __init__.py (working copy) @@ -880,10 +880,14 @@ if 'matplotlib.backends' in sys.modules: if warn: warnings.warn(_use_error_msg) return - arg = arg.lower() if arg.startswith('module://'): name = arg else: + # For non-module backends, normalize name to lowercase. Note that this + # must NOT be done to module backends, because those need to be valid + # Python module specifications that can be imported, and Python module + # names *are* case sensitive. + arg = arg.lower() be_parts = arg.split('.') name = validate_backend(be_parts[0]) if len(be_parts) > 1: ##### END PATCH I hope the comments explain clearly enough the problem. For a bit of context, this is biting us in ipython where we're building a custom backend for Qt terminals that inline mpl figures (very neat [1]), but our backend's name is module://IPython.zmq.pylab.backend_payload_svg. If you lowercase that, it won't import later. I know we shouldn't have called IPython's module with that funny capitalization, but it's a bit late to change now, I'm afraid. Do you foresee any problems with the above change? If everyone OK's it, I'm happy to commit it, but I won't do anything until others better informed than I reply. Regards, f [1] teaser for the curious: http://fperez.org/tmp/ipython_qt_pylab.png. All code is in the 'newkernel' github branch. Special credits to Evan Patterson from Enthought, the Qt brains behind the magic. |