Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mocpy does not work in python 3.4 #2

Closed
haussel opened this issue Jan 7, 2016 · 2 comments
Closed

mocpy does not work in python 3.4 #2

haussel opened this issue Jan 7, 2016 · 2 comments

Comments

@haussel
Copy link

haussel commented Jan 7, 2016

Hello,

I am interested in using mocpy, but rather would like to work in python 3.4 rather than in 2.7. I have a MOC file that I am trying to read. In python 2.7 it works fine:
Python 2.7.11 (default, Dec 5 2015, 23:51:51)
Type "copyright", "credits" or "license" for more information.

IPython 4.0.1 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.

In [1]: from mocpy import MOC

In [2]: mc = MOC.from_file('/Users/haussel/Downloads/Herschel-Stripe-82_MOC.fits’)

In python 3.4 I get the following error:

Python 3.4.4 (default, Dec 21 2015, 04:54:59)
Type "copyright", "credits" or "license" for more information.

IPython 4.0.1 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.

In [1]: from mocpy import MOC

In [2]: mc = MOC.from_file('/Users/haussel/Downloads/Herschel-Stripe-82_MOC.fits')

TypeError Traceback (most recent call last)
in ()
----> 1 mc = MOC.from_file('/Users/haussel/Downloads/Herschel-Stripe-82_MOC.fits')

/Users/haussel/Library/Python/3.4/lib/python/site-packages/mocpy/moc.py in from_file(cls, local_path)
204 @classmethod
205 def from_file(cls, local_path):
--> 206 return MOC_io.read_local(local_path)
207
208

/Users/haussel/Library/Python/3.4/lib/python/site-packages/mocpy/moc.py in read_local(path)
492 Read a MOC on the local file system
493 """
--> 494 return MOC_io.__parse(path)
495
496

/Users/haussel/Library/Python/3.4/lib/python/site-packages/mocpy/moc.py in __parse(path)
508
509
--> 510 return MOC.from_uniq_interval_set(interval_set)
511
512

/Users/haussel/Library/Python/3.4/lib/python/site-packages/mocpy/moc.py in from_uniq_interval_set(cls, uniq_is)
336
337 if order != last_order:
--> 338 r = r.union(rtmp)
339 rtmp.clear()
340 last_order = order

/Users/haussel/Library/Python/3.4/lib/python/site-packages/mocpy/interval_set.py in union(self, another_is)
106 """
107 interval_set = IntervalSet()
--> 108 interval_set._intervals = IntervalSet.merge_intervals(self.intervals + another_is.intervals)
109
110 return interval_set

/Users/haussel/Library/Python/3.4/lib/python/site-packages/mocpy/interval_set.py in merge_intervals(intervals)
47 ret = []
48 start = stop = None
---> 49 for itv in sorted(intervals):
50 if start is None:
51 start, stop = itv

TypeError: unorderable types: float() < NoneType()

@tboch
Copy link
Collaborator

tboch commented Jan 8, 2016

Hi Hervé,

thank you for the bug report. Could you provide me with the MOC you try to read ? That would help.
Thanks!

@tboch
Copy link
Collaborator

tboch commented Jan 12, 2016

Should be fixed now.
Running pip install --upgrade mocpy will get you the latest version

@tboch tboch closed this as completed Jan 12, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants