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

TapPlus parse simbad fail with non ascii char #2916

Closed
qq332982511 opened this issue Jan 5, 2024 · 4 comments
Closed

TapPlus parse simbad fail with non ascii char #2916

qq332982511 opened this issue Jan 5, 2024 · 4 comments

Comments

@qq332982511
Copy link

from astroquery.utils.tap.core import TapPlus
simbad = TapPlus(url="http://simbad.u-strasbg.fr/simbad/sim-tap")
rst = simbad.launch_job("SELECT title FROM ref WHERE oidbib='423320'")
print(rst.get_results().to_pandas().to_string())

error log:

UnicodeDecodeError: 'ascii' codec can't decode byte 0xb4 in position 13: ordinal not in range(128)
@bsipocz
Copy link
Member

bsipocz commented Jan 5, 2024

I'm afraid this is an upsteam issue, the returned VOtable seems to violate the votable linter. I'm inclined to close this issue as we can't do much about it in astroquery and as I detail it out below, it doesn't involve any of the functionalities from here.

Some other issues: Please not the big red warning at the top of the documentation, we do not support direct usage of TapPlus, please use PyVO instead. (but this doesn't effect the problem, the UnicodeDecodeError just as present with it.

cc @ManonMarchand for the upstream simbad issue (it also present on the branch of #2856)

Here is the votable, if that's of any help:

<?xml version="1.0" encoding="utf-8"?>
<VOTABLE version="1.3" xmlns="http://www.ivoa.net/xml/VOTable/v1.3" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.ivoa.net/xml/VOTable/v1.3 http://www.ivoa.net/xml/VOTable/v1.3">
<RESOURCE type="results">
<INFO name="QUERY_STATUS" value="OK"/>
<INFO name="PROVIDER" value="CDS">SIMBAD TAP Service</INFO>
<INFO name="QUERY" value="SELECT title FROM ref WHERE oidbib='423320'"/>
<TABLE name="result_S1704486906566">
<FIELD arraysize="*" datatype="char" name="title" ucd="meta.title" xtype="adql:CLOB">
<DESCRIPTION>Title</DESCRIPTION>
</FIELD>
<DATA>
<BINARY>
<STREAM encoding='base64'>
AAAASkRldGVjdGlvbiBvZiC0IFNjdXRpIFB1bHNhdG9ycyBpbiB0aGUgRWNsaXBz
aW5nIEJpbmFyaWVzIE9ic2VydmVkIGJ5IFRFU1Mu
</STREAM>
</BINARY>
</DATA>
</TABLE>
</RESOURCE>
</VOTABLE>

@bsipocz bsipocz closed this as completed Jan 5, 2024
@ManonMarchand
Copy link
Member

Thanks for the report and the perfect minimal example.

The error is upstream indeed. This field should be unicodechar and not char.

While waiting for the fix to be done on our side (might take a few days), note that you can open this votable with topcat (its parser is more permissive on types) or get the table in an other format through pyvo (fits, json and csv should work)

@aoberto
Copy link
Contributor

aoberto commented Jan 24, 2024

this should be solved now, sorry for the delay

@bsipocz
Copy link
Member

bsipocz commented Jan 24, 2024

Thanks @aoberto!

ManonMarchand added a commit to cds-astro/astroquery that referenced this issue Jan 26, 2024
some fields have changed their datatype upstream following astropy#2916
ManonMarchand added a commit to cds-astro/astroquery that referenced this issue Jan 26, 2024
some fields have changed their datatype upstream following astropy#2916
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants