Skip to content

Commit

Permalink
update changes.rst; work around another FITS_rec bug
Browse files Browse the repository at this point in the history
  • Loading branch information
sbailey committed Sep 2, 2016
1 parent 3981253 commit d91b51f
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
5 changes: 3 additions & 2 deletions doc/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@
Change Log
==========

1.7.1 (unreleased)
1.8.0 (unreleased)
------------------

* No changes yet
* Added :func:`~desiutil.io.encode_table` and :func:`~desiutil.io.decode_table`
for converting string columns in tables between unicode and bytes (PR #41).

1.7.0 (2016-08-18)
------------------
Expand Down
12 changes: 10 additions & 2 deletions py/desiutil/io.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,12 @@ def encode_table(data, encoding='ascii'):
'''
from astropy.table import Table
import numpy as np
table = Table(data, copy=False)

try:
table = Table(data, copy=False)
except ValueError: #- https://github.com/astropy/astropy/issues/5298
table = Table(data, copy=True)

encoding = _pick_encoding(table, encoding)

for col in table.colnames:
Expand Down Expand Up @@ -194,7 +199,10 @@ def decode_table(data, encoding='ascii', native=True):
'''
from astropy.table import Table
import numpy as np
table = Table(data, copy=False)
try:
table = Table(data, copy=False)
except ValueError: #- https://github.com/astropy/astropy/issues/5298
table = Table(data, copy=True)

#- Check if native str type is bytes
if native and np.str_('a').dtype.kind == 'S':
Expand Down

0 comments on commit d91b51f

Please sign in to comment.