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

icesat2.init() fail #435

Closed
linxiong100 opened this issue Oct 2, 2024 · 3 comments
Closed

icesat2.init() fail #435

linxiong100 opened this issue Oct 2, 2024 · 3 comments

Comments

@linxiong100
Copy link

code:
from sliderule import icesat2
icesat2.init("slideruleearth.io")
error:

JSONDecodeError Traceback (most recent call last)
File /gpfs/data1/vclgp/xiongl/env/linpy/lib/python3.11/site-packages/requests/models.py:971, in Response.json(self, **kwargs)
970 try:
--> 971 return complexjson.loads(self.text, **kwargs)
972 except JSONDecodeError as e:
973 # Catch JSON-related errors and raise as requests.JSONDecodeError
974 # This aliases json.JSONDecodeError and simplejson.JSONDecodeError

File /gpfs/data1/vclgp/xiongl/env/linpy/lib/python3.11/json/init.py:346, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
343 if (cls is None and object_hook is None and
344 parse_int is None and parse_float is None and
345 parse_constant is None and object_pairs_hook is None and not kw):
--> 346 return _default_decoder.decode(s)
347 if cls is None:

File /gpfs/data1/vclgp/xiongl/env/linpy/lib/python3.11/json/decoder.py:337, in JSONDecoder.decode(self, s, _w)
333 """Return the Python representation of s (a str instance
334 containing a JSON document).
335
336 """
--> 337 obj, end = self.raw_decode(s, idx=_w(s, 0).end())
338 end = _w(s, end).end()

File /gpfs/data1/vclgp/xiongl/env/linpy/lib/python3.11/json/decoder.py:355, in JSONDecoder.raw_decode(self, s, idx)
354 except StopIteration as err:
--> 355 raise JSONDecodeError("Expecting value", s, err.value) from None
356 return obj, end

JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

JSONDecodeError Traceback (most recent call last)
Cell In[21], line 1
----> 1 icesat2.init("slideruleearth.io")

File /gpfs/data1/vclgp/xiongl/env/linpy/lib/python3.11/site-packages/sliderule/icesat2.py:647, in init(url, verbose, max_resources, max_errors, loglevel)
645 loglevel = logging.INFO
646 logging.basicConfig(level=loglevel)
--> 647 sliderule.set_url(url)
648 sliderule.set_verbose(verbose)
649 sliderule.set_max_errors(max_errors)

File /gpfs/data1/vclgp/xiongl/env/linpy/lib/python3.11/site-packages/sliderule/sliderule.py:484, in set_url(urls)
482 raise TypeError('expected ip address or hostname as a string or list of strings')
483 # then update server table
--> 484 update_available_servers()

File /gpfs/data1/vclgp/xiongl/env/linpy/lib/python3.11/site-packages/sliderule/sliderule.py:510, in update_available_servers()
508 if service_url != None:
509 server_table = {}
--> 510 response = requests.get(service_url, data='{"service":"sliderule"}', timeout=request_timeout).json()
511 for entry in response['members']:
512 server_table["http://" + entry] = {"pending": 0, "errors": 0}

File /gpfs/data1/vclgp/xiongl/env/linpy/lib/python3.11/site-packages/requests/models.py:975, in Response.json(self, **kwargs)
971 return complexjson.loads(self.text, **kwargs)
972 except JSONDecodeError as e:
973 # Catch JSON-related errors and raise as requests.JSONDecodeError
974 # This aliases json.JSONDecodeError and simplejson.JSONDecodeError
--> 975 raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)

JSONDecodeError: Expecting value: line 1 column 1 (char 0)

@jpswinski
Copy link
Member

Thanks for reporting this error. Can you provide the version of the Python sliderule package you are using?

import sliderule
print(sliderule.__version__)

@linxiong100
Copy link
Author

the version is 1.4.6 when I am using pip install. It is not latest version by default.
I upgrade to version 4.7.1.
now it is working!
thanks!

@jpswinski
Copy link
Member

Excellent!

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

2 participants