Comment #12 on issue 3434 by hacm...@gmail.com: warning when starting isympy
http://code.google.com/p/sympy/issues/detail?id=3434

The issue, as pointed out before, is that sympy/__init__.py imports sympy.plotting, which in turn imports matplotlib.pyplot. isympy imports functionality from elsewhere in sympy, which causes sympy/__init__.py to be imported. Then isympy, via sympy.interatcive.session.init_session(), initializes pylab, which calls matplotlib.use(), raising the warning. As I see it, there are several options for dealing with this:

1. slightly hacky, but expedient: suppress warnings before running ip.enable_pylab() in sympy.interatcive.session.init_session(). This can be done with http://docs.python.org/2/library/warnings.html#warnings.catch_warnings , which is python 2.6+, but is a small amount of code to put into the compatibility module. This has the disadvantage of suppressing any valid warnings that might arise.

2. refactor plotting import: actually relatively straightforward, since matplotlib.pyplot is only used inside of one class (sympy.plotting.plot.MatplotlibBackend), so the import can be done within the __init__() method and a reference can be kept for the other functions. The downside is that this class is instantiated every time the plot() function is called (actually in the Plot.show() method).

3. refactor call of pylab initialize: probably the most work, possibly the most correct. Initialize pylab before any SymPy modules are imported. This would require moving a lot of code into the isympy script, among other things.

I would be happy to knock out solution 1 or 2 (between those, my preference is 2). I could be convinced to do 3, also, if people think that is best.

--
You received this message because this project is configured to send all issue notifications to this address.
You may adjust your notification preferences at:
https://code.google.com/hosting/settings

--
You received this message because you are subscribed to the Google Groups 
"sympy-issues" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sympy-issues+unsubscr...@googlegroups.com.
To post to this group, send email to sympy-issues@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy-issues?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to