Revision: 6168 http://matplotlib.svn.sourceforge.net/matplotlib/?rev=6168&view=rev Author: mdboom Date: 2008-10-08 13:59:28 +0000 (Wed, 08 Oct 2008)
Log Message: ----------- Addresses this Ubuntu bug: https://bugs.launchpad.net/ubuntu/+source/matplotlib/+bug/278764 Display a warning when show() is called with a non-GUI backend, so that the user is not left scratching their head when running "ipython -pylab" Modified Paths: -------------- trunk/matplotlib/lib/matplotlib/backends/__init__.py Modified: trunk/matplotlib/lib/matplotlib/backends/__init__.py =================================================================== --- trunk/matplotlib/lib/matplotlib/backends/__init__.py 2008-10-08 04:07:21 UTC (rev 6167) +++ trunk/matplotlib/lib/matplotlib/backends/__init__.py 2008-10-08 13:59:28 UTC (rev 6168) @@ -1,5 +1,6 @@ import matplotlib +import warnings # ipython relies on interactive_bk being defined here from matplotlib.rcsetup import interactive_bk @@ -28,9 +29,15 @@ # image backends like pdf, agg or svg do not need to do anything # for "show" or "draw_if_interactive", so if they are not defined # by the backend, just do nothing + def do_nothing_show(*args, **kwargs): + warnings.warn(""" +Your currently selected backend, '%s' does not support show(). +Please select a GUI backend in your matplotlibrc file ('%s') +or with matplotlib.use()""" % + (backend, matplotlib.matplotlib_fname())) def do_nothing(*args, **kwargs): pass backend_version = getattr(backend_mod,'backend_version', 'unknown') - show = getattr(backend_mod, 'show', do_nothing) + show = getattr(backend_mod, 'show', do_nothing_show) draw_if_interactive = getattr(backend_mod, 'draw_if_interactive', do_nothing) # Additional imports which only happen for certain backends. This section This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Matplotlib-checkins mailing list Matplotlib-checkins@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins