KeplerGO / K2fov

Check whether targets are in the field of view of NASA's K2 space telescope
http://keplerscience.arc.nasa.gov
MIT License
11 stars 10 forks source link

Python 3 compatibility fixes #1

Closed barentsen closed 9 years ago

barentsen commented 9 years ago

These changes allow K2fov to be imported in Python 3.

I verified that it doesn't break anything in my installation of Python 2, but in the absence of unit tests, it would be good for @mrtommyb to check that runK2onSilicon.py still runs after merging these changes.

mrtommyb commented 9 years ago

Great stuff! I will test and then merge

mrtommyb commented 9 years ago

Tested, it works

mrtommyb commented 9 years ago

I'm having an issue with this merge because I have some code where I import a function that is included in k2fov and I'm getting an error

/Users/tom/Dropbox/k2targetmanagement/make_field_plots_for_DRN.py in <module>()
      5
      6 sys.path.append('/Users/tom/gitcode/K2fov/K2fov')
----> 7 import projection as proj
      8 import  fov
      9 from K2onSilicon import angSepVincenty, getRaDecRollFromFieldnum

/Users/tom/gitcode/K2fov/K2fov/projection.py in <module>()
      4     pass
      5 import numpy as np
----> 6 from . import rotate
      7
      8 __version__ = "$Id: projection.py 36 2014-01-23 22:19:15Z fergalm $"

ValueError: Attempted relative import in non-package
barentsen commented 9 years ago

Looking into it.

mrtommyb commented 9 years ago

I think it's ok. I just need to write better code. I changed my code to read

from K2fov import projection as proj
from K2fov import fov
from K2fov.K2onSilicon import angSepVincenty, getRaDecRollFromFieldnum

and now it seems to work

barentsen commented 9 years ago

Yep, I was suspecting your direct import of modules, rather than the package, was causing this.

Stopped looking into it. :strawberry: