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

The casjobs query results involving bigint column produce errors. #10

Open
segasai opened this issue Mar 25, 2020 · 0 comments
Open

The casjobs query results involving bigint column produce errors. #10

segasai opened this issue Mar 25, 2020 · 0 comments

Comments

@segasai
Copy link

segasai commented Mar 25, 2020

Hi,

When trying to query the skyserver/casjobs I can do it without issues if I don't ask for the specobjid column in a query , but if I add it, I'm getting a bunch of errors.

The simple code (based on the example) is given below

import SciServer
from SciServer import Authentication, LoginPortal, Config, CasJobs, SkyQuery, SciDrive, SkyServer, Files, Jobs
import os
import pandas
import sys
import json
from io import StringIO
from io import BytesIO
#from PIL import Image                                                                                                                                                   
import numpy as np
import matplotlib.pyplot as plt

Authentication_loginName = '**'  #CHANGE ME 
Authentication_loginPassword = '**'

token1 = LoginPortal.login(Authentication_loginName,
                           Authentication_loginPassword)

casJobsId = CasJobs.getSchemaName()
print(casJobsId)
Query = ' select top 10 ra,dec from specphotoall'  # this works                                                                                                          
Query = ' select top 10 ra,dec,plate from specphotoall'  # this works                                                                                                    
Query = ' select top 10 ra,dec,specobjid from specphotoall'  #this doesn't                                                                                               
df = CasJobs.executeQuery(sql=Query, context='DR16', format="fits")

fd = open('xx.fits', 'wb')
fd.write(df.read())
fd.close()

The error is

Traceback (most recent call last):
  File "/home/koposov/pyenv36/lib/python3.6/site-packages/urllib3/response.py", line 685, in _update_chunk_length
    self.chunk_left = int(line, 16)
ValueError: invalid literal for int() with base 16: b''

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/koposov/pyenv36/lib/python3.6/site-packages/urllib3/response.py", line 425, in _error_catcher
    yield
  File "/home/koposov/pyenv36/lib/python3.6/site-packages/urllib3/response.py", line 752, in read_chunked
    self._update_chunk_length()
  File "/home/koposov/pyenv36/lib/python3.6/site-packages/urllib3/response.py", line 689, in _update_chunk_length
    raise httplib.IncompleteRead(line)
http.client.IncompleteRead: IncompleteRead(0 bytes read)
During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/koposov/pyenv36/lib/python3.6/site-packages/requests/models.py", line 751, in generate
    for chunk in self.raw.stream(chunk_size, decode_content=True):
  File "/home/koposov/pyenv36/lib/python3.6/site-packages/urllib3/response.py", line 560, in stream
    for line in self.read_chunked(amt, decode_content=decode_content):
  File "/home/koposov/pyenv36/lib/python3.6/site-packages/urllib3/response.py", line 781, in read_chunked
    self._original_response.close()
  File "/home/koposov/python36/lib/python3.6/contextlib.py", line 99, in __exit__
    self.gen.throw(type, value, traceback)
  File "/home/koposov/pyenv36/lib/python3.6/site-packages/urllib3/response.py", line 443, in _error_catcher
    raise ProtocolError("Connection broken: %r" % e, e)
urllib3.exceptions.ProtocolError: ('Connection broken: IncompleteRead(0 bytes read)', IncompleteRead(0 bytes read))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "doit.py", line 23, in <module>
    df = CasJobs.executeQuery(sql=Query, context='DR16', format="fits")
  File "/home/koposov/pyenv36/lib/python3.6/site-packages/SciServer-2.0.13-py3.6.egg/SciServer/CasJobs.py", line 171, in executeQuery
  File "/home/koposov/pyenv36/lib/python3.6/site-packages/requests/models.py", line 829, in content
    self._content = b''.join(self.iter_content(CONTENT_CHUNK_SIZE)) or b''
  File "/home/koposov/pyenv36/lib/python3.6/site-packages/requests/models.py", line 754, in generate
    raise ChunkedEncodingError(e)
requests.exceptions.ChunkedEncodingError: ('Connection broken: IncompleteRead(0 bytes read)', IncompleteRead(0 bytes read))

Background info. I'm using sciserver-2.0.13 and python 3.6.10 on linux.

Thanks
Sergey

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