On 20/03/12 08:36, Pierre Raybaut wrote:
Hi all,

If you are executing your script in a dedicated Python interpreter
(default behavior), then Matplotlib will be imported before executing
your script only if the backend option (mentioned by David) is checked
(default value). So, to avoid this, simply uncheck this option, or
choose the backend that you want there (@David: the monitor does not
require Matplotlib at startup).

If you are executing your script in an existing Python interpreter,
with default options, the PYTHONSTARTUP script is the
'scientific_startup.py' script which also imports Matplotlib. But this
can also be changed in Preferences.

Last but not least, I do agree with you David that this kind of
side-effect should be documented somewhere.

Ben, could you tell us where would you have expected this to be documented?

-Pierre

Apologies for late reply, I didn't see your message until now.

It's a tough one to call really - I wasn't familiar with the .use() call at first, so had to check and re-check matplotlib's docs a number of times to make sure I had syntax right, backends installed, etc etc. Pretty frustrating until I ran the script from shell prompt and twigged.

I suppose anywhere in the help docs that's searchable, perhaps using as many related terms as possible: backend, mpl.use(), pylab. Maybe even quoting the warning message from matplotlib's __init__.py:

/usr/lib/pymodules/python2.6/matplotlib/__init__.py:890: UserWarning:  This 
call to matplotlib.use() has no effect
because the the backend has already been chosen;
matplotlib.use() must be called *before* pylab, matplotlib.pyplot,
or matplotlib.backends is imported for the first time.

Ben.

--
You received this message because you are subscribed to the Google Groups 
"spyder" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/spyderlib?hl=en.

Reply via email to