Erin Sheldon
Erin Sheldon
I'm sorry I didn't reply to this earlier. I think this should be possible, but would be some work to implement. Is this something you would like to contribute?
I have not been able to find a way to do this
You need to write something. To create an empy first HDU, write None ```python import fitsio fname = 'test.fits' with fitsio.FITS(fname, mode='rw', clobber=True) as fits: fits.write(None) with fitsio.FITS(fname) as fits:...
I converted this to a feature request
There is something to discuss about this. If we implemented this feature request then it would not be possible to update the file at a later date to contain data...
That would not match expectations for python file opening; if you use `open(fname, 'w')` it will create the file
The code does raise `OSError` on trying to open an empty file with mode read only
I will argue that If you open a file with mode `rw` and don't write anything it is a bug
Note this is underlying cfitsio behavior not fitsio behavior; the same thing happens if you open a file with cfitsio and don't write anything, it leaves an empty file and...