Skip to content

fitsio dependacy must be < 1.00 #33

Open
@jacobic

Description

Hi guys

Thanks for all your hard work with this package!

I just wanted to let you know about a small hiccup that I encountered when running redmapper with the latest version of fitsio. There are many instances within the source code which call the decode method on byte strings loaded with fitsio e.g. reading the master galaxy table within redmapper/configuration.py.

However this causes errors of the following type of error:

  File "/u/jacobic/hyperpipes/src/scripts/redmapper_calibrate.py", line 18, in <module>
    calib = redmapper.calibration.RedmapperCalibrator(args.configfile)
  File "/u/jacobic/.local/anaconda3/envs/redmapper/lib/python3.7/site-packages/redmapper-0.2.5-py3.7-linux-x86_64.egg/redmapper/calibration/calibrate.py", line 46, in __init__
    self.config = Configuration(conf)
  File "/u/jacobic/.local/anaconda3/envs/redmapper/lib/python3.7/site-packages/redmapper-0.2.5-py3.7-linux-x86_64.egg/redmapper/configuration.py", line 426, in __init__
    gal_stats = self._galfile_stats()
  File "/u/jacobic/.local/anaconda3/envs/redmapper/lib/python3.7/site-packages/redmapper-0.2.5-py3.7-linux-x86_64.egg/redmapper/configuration.py", line 649, in _galfile_stats
    mode = master['MODE'][0].rstrip().decode()
AttributeError: 'str' object has no attribute 'decode'

The reason for this is explained here (see penultimate section):

python 3 strings:

As of version 1.0.0, fitsio now supports Python 3 strings natively. This support means that for Python 3, native strings are read from and written correctly to FITS files. All byte string columns are treated as ASCII-encoded unicode strings as well. For FITS files written with a previous version of fitsio, the data in Python 3 will now come back as a string and not a byte string. Note that this support is not the same as full unicode support. Internally, fitsio only supports the ASCII character set.

Downgrading from v1.03 to v0.9.12 resolves the issue. Would it be possible to add this information to the requirements section of the README? or ideally remove the calls to decode and state the minimum version of fitsio should be 1.00.

Thanks in advance,
Jacob

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions