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.

Passing a pathlib.Path object to fits.open leads to an empty HDUList object

See original GitHub issue
with fits.open(pathlib.Path("/...")) as hdul:
    print(hdul)
[]

Issue Analytics

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

github_iconTop GitHub Comments

2reactions
bsipoczcommented, Nov 1, 2018

@pllim - you can define custom ipython magics in e.g. ~/.ipython/profile_default/startup/ e.g mine looks like:

from IPython.core.magic import register_line_cell_magic

ip = get_ipython()


@register_line_cell_magic
def astro(self):
    ip.ex('import numpy as np')
    ip.ex('import matplotlib.pylab as plt')

    ip.ex('from astropy.table import Table, Column, join, vstack, hstack')
    ip.ex('from astropy.coordinates import SkyCoord, Angle')
    ip.ex('import astropy.units as u')
    ip.ex('from astropy.io import fits')
Read more comments on GitHub >

github_iconTop Results From Across the Web

File Handling and Convenience Functions — Astropy v5.2
Factory function to open a FITS file and return an HDUList object. Parameters. name str , file-like object or pathlib.Path.
Read more >
pathlib — Object-oriented filesystem paths — Python 3.11.1 ...
PEP 428: The pathlib module – object-oriented filesystem paths. ... Opening a file: ... When pathsegments is empty, the current directory is assumed:....
Read more >
File Handling and Convenience Functions - Read the Docs
Factory function to open a FITS file and return an HDUList object. Parameters: name : file path, file object, file-like object or pathlib.Path...
Read more >
Python 3's pathlib Module: Taming the File System
In this tutorial, you will see how to work with file paths—names of directories and files—in Python. You will learn new ways to...
Read more >
Full Changelog — SunPy 4.1.0 documentation
Trying to download an empty search response from the JSOC now results in an empty results object. Previously the results object contained the...
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