Skip to content

OSError: Empty or corrupt FITS file (HEADER) #5732

Closed

Description

@jacopovpsi

hello guys, I've a problem with

astropy.io.open()
>>> OSError: Empty or corrupt FITS file

in particular I'm loading some files .fits and I know that the headers have a not valid character
TEMP = -64.000000 / Actual temperature (�C)
so I've tried with fitsio.read() and it works, but I don't like to use it.
I've tried with fits.open(path,ignore_missing_end=True)
but I still have the same problem.
Do you have any idea on how to get the data without header issue??
Thank you

Activity

  1. pllim commented on Jan 24, 2017

    @pllim
    Member

    Which version of Astropy are you using? Which Python version? What is the complete Python commands and traceback? What happens when you run fitscheck on the file?

  2. jacopovpsi commented on Jan 24, 2017

    @jacopovpsi
    Author

    Metadata-Version: 1.1
    Name: astropy
    Version: 1.2.1

    and python 3.5.2

    mpc:~$ fitscheck data.fits /anaconda/lib/python3.5/site-packages/pyfits/hdu/hdulist.py:848: VerifyWarning: Error validating header for HDU #0 (note: PyFITS uses zero-based indexing). 'ascii' codec can't decode byte 0xb0 in position 1973: ordinal not in range(128) There may be extra bytes after the last HDU or the file is corrupted. (len(hdulist), indent(str(exc))), VerifyWarning) EXCEPTION 'data.fits' .. Empty or corrupt FITS file 1 errors

    and the error 'ascii' codec can't decode byte 0xb0 in position 1973' is exacly the one reported before about the character
    Thank you

  3. pllim commented on Jan 24, 2017

    @pllim
    Member

    Looks like a duplicate of #5093 . For now, either use Python 2 or fix the FITS header.

  4. aburgasser commented on May 6, 2017

    @aburgasser

    I'm having this same problem with NIRC2 imaging data - can someone explain how to "fix the FITS header"

  5. pllim commented on May 6, 2017

    @pllim
    Member

    A workaround is to open it (successfully) in Python 2, and then use writeto() to write out a valid file for Python 3.

  6. saimn commented on May 19, 2017

    @saimn
    Contributor

    Should be fixed by #6084 (if not, please reopen).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions