question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

4.0.5 / 4.2.1 : Long card images must have CONTINUE cards after the first card

See original GitHub issue

Description

An error is reported when saving an hdulist to a fits file that only occurs with version 4.2.1 and 4.0.5 of astropy. I’ve tracked the specific patch that is the determining factor to https://github.com/astropy/astropy/pull/11108.

See related issue here https://git.ligo.org/lscsoft/ligo.skymap/-/issues/26

Expected behavior

There should be no output and a fits file should be generated.

Actual behavior

Traceback (most recent call last):
  File "test.py", line 3, in <module>
    data.writeto('test.fits')
  File "/home/ahnitz/projects/env3/lib/python3.8/site-packages/astropy/utils/decorators.py", line 535, in wrapper
    return function(*args, **kwargs)
  File "/home/ahnitz/projects/env3/lib/python3.8/site-packages/astropy/io/fits/hdu/hdulist.py", line 919, in writeto
    self.verify(option=output_verify)
  File "/home/ahnitz/projects/env3/lib/python3.8/site-packages/astropy/io/fits/verify.py", line 73, in verify
    errs = self._verify(opt)
  File "/home/ahnitz/projects/env3/lib/python3.8/site-packages/astropy/io/fits/hdu/hdulist.py", line 1245, in _verify
    result = hdu._verify(option)
  File "/home/ahnitz/projects/env3/lib/python3.8/site-packages/astropy/io/fits/hdu/table.py", line 535, in _verify
    errs = super()._verify(option=option)
  File "/home/ahnitz/projects/env3/lib/python3.8/site-packages/astropy/io/fits/hdu/base.py", line 1587, in _verify
    errs = super()._verify(option=option)
  File "/home/ahnitz/projects/env3/lib/python3.8/site-packages/astropy/io/fits/hdu/base.py", line 1074, in _verify
    errs.append(card._verify(option))
  File "/home/ahnitz/projects/env3/lib/python3.8/site-packages/astropy/io/fits/card.py", line 1118, in _verify
    keyword, valuecomment = self._split()
  File "/home/ahnitz/projects/env3/lib/python3.8/site-packages/astropy/io/fits/card.py", line 815, in _split
    for card in self._itersubcards():
  File "/home/ahnitz/projects/env3/lib/python3.8/site-packages/astropy/io/fits/card.py", line 1170, in _itersubcards
    raise VerifyError(
astropy.io.fits.verify.VerifyError: Long card images must have CONTINUE cards after the first card.

Steps to Reproduce

To reproduce you’ll need the specific data that was trying to be written. I’ve pickled the hdulist to make this possible (file attached and put into save.zip). With that file, one should be able to reproduce with the following.

save.zip

import pickle
data = pickle.load(open('save.pkl', 'rb'))
data.writeto('test.fits')

The data was created by the ligo.skymap library at this line. https://git.ligo.org/lscsoft/ligo.skymap/-/blob/master/ligo/skymap/io/fits.py#L384

System Details

(env3) [ahnitz@hnb697 live]$ python d.py Linux-5.11.8-200.fc33.x86_64-x86_64-with-glibc2.2.5 Python 3.8.8 (default, Feb 20 2021, 00:00:00) [GCC 10.2.1 20201125 (Red Hat 10.2.1-9)] Numpy 1.20.2 astropy 4.2.1 Scipy 1.6.0 Matplotlib 3.4.1

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
titodalcantoncommented, Apr 6, 2021

Here is a shorter test case that reproduces the same error for me:

import numpy as np
from astropy.table import Table
from astropy.io import fits


history = ['a.very.loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong.string']

m = Table(np.ones(16, dtype=float), copy=False)
m.meta.update({'history': history})
hdu = fits.table_to_hdu(m)
hdulist = fits.HDUList([fits.PrimaryHDU(), hdu])
hdulist.writeto('test2.fits', overwrite=True)

0reactions
embraycommented, Apr 6, 2021

Workaround in #11487.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Source code for astropy.io.fits.card
FSC commentary card string which must contain printable ASCII characters. ... "Long card images must have CONTINUE cards after " "the first card...
Read more >
Grid system - Bootstrap
Use our powerful mobile-first flexbox grid to build layouts of all shapes and sizes ... Specify a numbered class when you need a...
Read more >
Chain Reaction: Energy in Motion - K-12 Alliance
Use this optional assessment if students need support to understand that observations can produce data as evidence, that within a system, moving objects ......
Read more >
Release Notes for Cisco Unity Release 4.2(1) [Cisco Unity] - Cisco ...
The functionality is available only during the After Message menu and only to subscribers who are assigned a Custom Keypad Mapping conversation. For...
Read more >
GAO-09-232G Federal Information System Controls Audit ...
We have updated the. FISCAM for significant changes affecting IS audits. This revised FISCAM reflects consideration of public comments received from ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found