Skip to content

Saving to file is broken for Cadc #2371

Description

@bsipocz

An example from the docs is failing, and it seems to be a legit issue (tests for this is turned off atm):

451 Query saving results in a file:
452 
453 .. code-block:: python
454 .. doctest-remote-data::
455 
456     >>> from astroquery.cadc import Cadc
457     >>> cadc = Cadc()
458     >>> job = cadc.exec_sync("SELECT TOP 10 observationID, obsID FROM caom2.Observation AS Observation",
UNEXPECTED EXCEPTION: TypeError("a bytes-like object is required, not 'Table'")
Traceback (most recent call last):
  File "/Users/bsipocz/.pyenv/versions/3.9.1/lib/python3.9/doctest.py", line 1336, in __run
    exec(compile(example.source, filename, "single",
  File "<doctest cadc.rst[59]>", line 1, in <module>
  File "/private/var/folders/9s/070g0pd502q70k3gffpxv8km0000gq/T/astroquery-test-3i0bidqs/lib/python3.9/site-packages/astroquery/cadc/core.py", line 615, in exec_sync
    f.write(result)
TypeError: a bytes-like object is required, not 'Table'
/private/var/folders/9s/070g0pd502q70k3gffpxv8km0000gq/T/astroquery-test-3i0bidqs/lib/python3.9/site-packages/docs/cadc/cadc.rst:458: UnexpectedException
=============================================== short test summary info ================================================

cc @andamian

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions