astropy: tabledump is broken when the output file is not specified
It seems that previously an HDU could access to its parent HDUList with a _HDUList__file
attribute, and this was used to get the filename
. I think the simplest solution would be to make the output file mandatory (datafile
).
In [3]: fits.tabledump('astropy/io/fits/tests/data/tb.fits')
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-3-c48651aaf53f> in <module>()
----> 1 fits.tabledump('astropy/io/fits/tests/data/tb.fits')
~/dev/astropy/astropy/utils/decorators.py in wrapper(*args, **kwargs)
485 # one with the name of the new argument to the function
486 kwargs[new_name[i]] = value
--> 487 return function(*args, **kwargs)
488
489 return wrapper
~/dev/astropy/astropy/io/fits/convenience.py in tabledump(filename, datafile, cdfile, hfile, ext, overwrite)
888 # TODO: Really need to provide a better way to access the name of
889 # any files underlying an HDU
--> 890 root, tail = os.path.splitext(f._HDUList__file.name)
891 datafile = root + '_' + repr(ext) + '.txt'
892
AttributeError: 'HDUList' object has no attribute '_HDUList__file'
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 19 (10 by maintainers)
Commits related to this issue
- Fixed tabledump file name issue [#6937] — committed to ricardogando/astropy by ricardogando 7 years ago
- Fixed tabledump file name issue [#6937] — committed to ricardogando/astropy by ricardogando 7 years ago
- Merge pull request #6976 from ricardogando/bugfix-for-issue-6937 Fixed tabledump file name issue [#6937] — committed to astropy/astropy by saimn 7 years ago
- Merge pull request #6976 from ricardogando/bugfix-for-issue-6937 Fixed tabledump file name issue [#6937] — committed to astropy/astropy by saimn 7 years ago
- minor fixes to guppidrift2fil.py Hours2hms etc functions are from the presto package, which is under presto (i.e presto.presto), so we need to import presto from presto. Fixed integer division for... — committed to tolszans/presto by tolszans 4 years ago
- minor fixes to guppidrift2fil.py Hours2hms etc functions are from the presto package, which is under presto (i.e presto.presto), so we need to import presto from presto. Fixed integer division for... — committed to tolszans/presto by tolszans 4 years ago
- minor fixes to guppidrift2fil.py Hours2hms etc functions are from the presto package, which is under presto (i.e presto.presto), so we need to import presto from presto. Fixed integer division for... — committed to tolszans/presto by tolszans 4 years ago
YEAH ! No error !!
@ricardogando Sure! No problem. I will try some other issue.
@vermashresth I am going through this issue with a student and would like to close the astropy contribution cycle with him. Unfortunately, I could not finish it during office hours last week. Would you mind taking another issue? I certainly do not claim ownership over issues and if you have or would to like to work on it, please go ahead.
@vermashresth - maybe check with @ricardogando if he started to work on it, but otherwise it fine by me.