astropy/astropy — pull request #2498 by lpsinger (2014-05-15 21:38:06+00:00)
Title: Support writing IPAC-style tables that contain no data

This fixes the following error:

>>> import astropy.table
>>> t = astropy.table.Table(names=['a', 'b'])
>>> t.write('test.dat', format='ascii.ipac')
Traceback (most recent call last):
File "", line 1, in
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/astropy/table/table.py", line 2471, in write
io_registry.write(self, *args, **kwargs)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/astropy/io/registry.py", line 358, in write
writer(data, *args, **kwargs)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/astropy/io/ascii/connect.py", line 39, in io_write
return write(table, filename, format=format, **kwargs)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/astropy/io/ascii/ui.py", line 295, in write
lines = writer.write(table)
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/astropy/io/ascii/ipac.py", line 194, in write
col.width = max([len(vals[i]) for vals in data_str_vals])
ValueError: max() arg is an empty sequence

Unit test included.