mailRe: Why is a range in relax created as xrange objects which is not sliceable?


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by Troels Emtekær Linnet on December 10, 2013 - 14:14:
Hi Edward.

To solve the wxPython problem on my Mac 10.9, I reverted
to use "epd" enthought python distribution.

This ships with dateutil version 1.5, which give the problem.

I have written the install details here:
http://wiki.nmr-relax.com/Installation_mac_mavericks_os_x

The fix for dateutil was dead simple.

sudo pip install python-dateutil --upgrade

I have noted this down here:
http://wiki.nmr-relax.com/Matplotlib_dateutil_bug

Now I am finally in position to plot directly in matplotlib.






2013/12/10 Edward d'Auvergne <edward@xxxxxxxxxxxxx>
Ok, so it was an some random package failing!  According to
http://labix.org/python-dateutil, version 2.0 is Python 3 compatible.
So these lines must have been fixed.  Matplotlib looks like it bundles
dateutil with itself.  I don't know how long it will take matplotlib
to bundle a functional dateutil package!  Are you using the newest
version of matplotlib?

Regards,

Edward

On 10 December 2013 12:59, Troels Emtekær Linnet <tlinnet@xxxxxxxxxxxxx> wrote:
> If I change
>
> /Library/Frameworks/Python.framework/Versions/7.3/lib/python2.7/site-packages/dateutil/rrule.py
>
> From
> -------
> line 25
> M29, M30, M31 = range(1,30), range(1,31), range(1,32)
> line 28
> M29, M30, M31 = range(-29,0), range(-30,0), range(-31,0)
>
> To
> ------
> M29, M30, M31 = list(range(1,30)), list(range(1,31)), list(range(1,32))
> M29, M30, M31 = list(range(-29,0)), list(range(-30,0)), list(range(-31,0))
>
> I can now import matplotlib in relax.
>
> Best
> Troels
>
>
>
> 2013/12/10 Troels Emtekær Linnet <tlinnet@xxxxxxxxxxxxx>
>>
>> Hi Edward.
>>
>> I wonder why range objects in relax by default are created as
>> xrange objects?
>>
>> I think this is related to the error when importing matplotlib.
>> from pylab import *
>>
>> -------
>> relax> M31=range(10)
>> relax> type(M31)
>> <type 'xrange'>
>> relax> print M31[:7]
>> Traceback (most recent call last):
>>   File "<console>", line 1, in <module>
>> TypeError: sequence index must be integer, not 'slice'
>> -----
>>
>> Best
>> Troels
>
>
>
> _______________________________________________
> relax (http://www.nmr-relax.com)
>
> This is the relax-devel mailing list
> relax-devel@xxxxxxx
>
> To unsubscribe from this list, get a password
> reminder, or change your subscription options,
> visit the list information page at
> https://mail.gna.org/listinfo/relax-devel
>


Related Messages


Powered by MHonArc, Updated Tue Dec 10 14:40:06 2013