Skip to content

BepiColombo notebook fails: astropy 7 dropped HTTP URL support in fits.open() #94

Description

@jordanpadams

🐛 Describe the bug

astropy.io.fits.open() no longer accepts HTTP URLs directly as of astropy 7.x. The notebook passes a URL string to fits.open(), which now raises OSError: No SIMPLE card found, this file does not appear to be a valid FITS file.

🕵️ Expected behavior

Notebook opens FITS files over HTTP and renders the BepiColombo image grid without error.

📜 To Reproduce

  1. Install requirements-geo.txt
  2. Run notebooks/discipline/geo/BepiColombo_FlybyVisualization.ipynb
  3. Cell that calls fits.open(image_path) with an HTTP URL raises OSError

⚙️ Fix

Add fsspec and aiohttp to requirements-geo.txt and pass use_fsspec=True to fits.open(), or download the file to a temp path before opening:

# Option A
with fits.open(image_path, use_fsspec=True) as hdul:
    image_data = hdul[1].data

# Option B
import tempfile, requests
with tempfile.NamedTemporaryFile(suffix='.fits') as tmp:
    tmp.write(requests.get(image_path).content)
    tmp.flush()
    with fits.open(tmp.name) as hdul:
        image_data = hdul[1].data

🖥 Environment Info

  • astropy~=7.2.0, Python 3.13.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status
    ToDo
    Status
    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions