Skip to content
Browse files

Fixed backwards compatibility for PyFITS comment changes

  • Loading branch information...
1 parent 677b787 commit baa49f3f6ac04a0b0164faa6757f0db0880e3080 @khughitt khughitt committed Jul 11, 2012
Showing with 10 additions and 7 deletions.
  1. +1 −6 doc/source/dev.rst
  2. +9 −1 sunpy/io/fits.py
View
7 doc/source/dev.rst
@@ -82,12 +82,7 @@ as a `remote` in git: ::
To stay up to date you can grab the latest changes to the SunPy master using
the commands: ::
- git fetch upstream
- git merge upstream/master
-
-You can also do this in one line with: ::
-
- git pull upstream/master
+ git pull upstream master
This will merge the upstream code automatically. After running either of these commands,
your local copy of your personal repo is just a copy of the main repo.
View
10 sunpy/io/fits.py
@@ -36,7 +36,15 @@ def read(filepath):
hdulist = pyfits.open(filepath)
hdulist.verify('silentfix')
- comments = [card.value for card in hdulist[0].header.get_comment()]
+ fits_comment = hdulist[0].header.get_comment()
+
+ # PyFITS 2.x
+ if isinstance(fits_comment[0], basestring):
+ comments = [val for val in fits_comment]
+ else:
+ # PyFITS 3.x
+ comments = [card.value for card in fits_comment]
+
comment = "".join(comments).strip()
header = MapHeader(hdulist[0].header)
header['comment'] = comment

0 comments on commit baa49f3

Please sign in to comment.
Something went wrong with that request. Please try again.