Matplotlib dateutil bug
Background
When you create a range in relax, it is created as an xrange object.
You cannot by default slice through xrange objects.
The dateutil.rrule package used in matplotlib/pylab creates some list, which it expects it can slice through.
But relax will create these as xrange which is not-sliceable.
Let's try it out.
USER@MACHINE: $ python
>>> x=range(10)
>>> type(x)
<type 'list'>
>>> print x[:3]
[0, 1, 2]
>>> y=xrange(10)
>>> type(y)
<type 'xrange'>
>>> print y[:3]
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: sequence index must be integer, not 'slice'
USER@MACHINE: $ relax
relax> x=range(10)
relax> type(x)
<type 'xrange'>
relax> print x[:3]
Traceback (most recent call last):
File "<console>", line 1, in <module>
TypeError: sequence index must be integer, not 'slice'
relax> y=list(range(10))
relax> print y[:3]
[0, 1, 2]
relax>
The error when importing matplotlib / pyplot
USER@MACHINE: $ relax
relax> from pylab import *
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/site-packages/pylab.py", line 1, in <module>
from matplotlib.pylab import *
File "/Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/site-packages/matplotlib/pylab.py", line 221, in <module>
from matplotlib import mpl # pulls in most modules
File "/Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/site-packages/matplotlib/mpl.py", line 3, in <module>
from matplotlib import axes
File "/Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/site-packages/matplotlib/axes.py", line 19, in <module>
import matplotlib.dates as mdates
File "/Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/site-packages/matplotlib/dates.py", line 119, in <module>
from dateutil.rrule import rrule, MO, TU, WE, TH, FR, SA, SU, YEARLY, \
File "/Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/site-packages/dateutil/rrule.py", line 26, in <module>
MDAY366MASK = tuple(M31+M29+M31+M30+M31+M30+M31+M31+M30+M31+M30+M31+M31[:7])
TypeError: unsupported operand type(s) for +: 'xrange' and 'xrange'
Change bug
bash
MFILE=`python -c "import dateutil.rrule; print(dateutil.rrule.__file__)"`
echo $MFILE
Test if it worked
$ relax
relax> from pylab import *
Traceback (most recent call last):
File "<console>", line 1, in <module>
File "/Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/site-packages/pylab.py", line 1, in <module>
from matplotlib.pylab import *
File "/Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/site-packages/matplotlib/pylab.py", line 221, in <module>
from matplotlib import mpl # pulls in most modules
File "/Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/site-packages/matplotlib/mpl.py", line 3, in <module>
from matplotlib import axes
File "/Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/site-packages/matplotlib/axes.py", line 19, in <module>
import matplotlib.dates as mdates
File "/Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/site-packages/matplotlib/dates.py", line 119, in <module>
from dateutil.rrule import rrule, MO, TU, WE, TH, FR, SA, SU, YEARLY, \
File "/Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/site-packages/dateutil/rrule.py", line 26, in <module>
MDAY366MASK = tuple(M31+M29+M31+M30+M31+M30+M31+M31+M30+M31+M30+M31+M31[:7])
TypeError: unsupported operand type(s) for +: 'xrange' and 'xrange'