Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unencoded CadcTapClient csv response format causes TypeError in astropy Table.read #127

Open
SharonGoliath opened this issue Nov 28, 2019 · 0 comments

Comments

@SharonGoliath
Copy link
Collaborator

When using the results of tap query in 'csv' format to build an astropy Table instance, get a "TypeError: read() should return bytes" exception.

The following code will raise the exception:

subject = net.Subject(certificate='./cadcproxy.pem')
tap_client = CadcTapClient(subject, resource_id='ivo://cadc.nrc.ca/ad')
buffer = io.StringIO()
tap_client.query(query, output_file=buffer, data_only=True,
                             response_format=‘csv’)
table = astropy.table.Table.read(buffer, format='csv')

This can be worked around by using BytesIO(buffer.getvalue().encode('utf-8')) as the argument to Table, but it's inefficient to decode/encode large results sets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant