aghasemi / streamlit_js_eval

A custom Streamlit component to evaluate arbitrary Javascript expressions
MIT License
81 stars 12 forks source link

TypeError in get_page_location #6

Closed Renukumar-R closed 8 months ago

Renukumar-R commented 8 months ago

TypeError Traceback (most recent call last) Cell In[99], line 1 ----> 1 streamlit_js_eval.get_page_location(component_key='port')

File ~/anaconda3/envs/myenv/lib/python3.11/site-packages/streamlit_js_eval/init.py:52, in get_page_location(component_key) 50 def get_page_location(component_key=None): 51 if component_key is None: component_key='LOC' ---> 52 return json.loads(streamlit_js_eval(js_expressions='JSON.stringify(window.location)', key = component_key))

File ~/anaconda3/envs/myenv/lib/python3.11/json/init.py:339, in loads(s, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw) 337 else: 338 if not isinstance(s, (bytes, bytearray)): --> 339 raise TypeError(f'the JSON object must be str, bytes or bytearray, ' 340 f'not {s.class.name}') 341 s = s.decode(detect_encoding(s), 'surrogatepass') 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):

TypeError: the JSON object must be str, bytes or bytearray, not NoneType

aghasemi commented 8 months ago

Thanks. I will review your PR.

aghasemi commented 8 months ago

Your change is available in the new version 0.1.7.

Thanks for your contribution.

Renukumar-R commented 8 months ago

Thanks for your quick fix