mondul / HiyaCFW-Helper

Tool for making the HiyaCFW (and TWiLightMenu++) installation process simpler
The Unlicense
119 stars 18 forks source link

py: Error geting json from github api #49

Closed poofyteddy closed 5 years ago

poofyteddy commented 5 years ago

Hello, I just used your soft for the first time (thank's for the work) and i encounter this error while

downloading the last version of HiyaCFW
Exception in thread Thread-2:
Traceback (most recent call last):
  File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.5/threading.py", line 862, in run
    self._target(*self._args, **self._kwargs)
  File "./HiyaCFW_Helper.py", line 308, in get_latest_hiyacfw
    latest = jsonify(conn)
  File "/usr/lib/python3.5/json/__init__.py", line 268, in load
    parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
  File "/usr/lib/python3.5/json/__init__.py", line 312, in loads
    s.__class__.__name__))
TypeError: the JSON object must be str, not 'bytes'

From what i have dig, it happens during the jsonify(conn) L308 I did a quick update of my system before hand, but maybe i my library are outdated, i can't really check that.

Sorry for bothering :)

poofyteddy commented 5 years ago

because i needed it to work, i did quick hack replacing the line by

import json
latest = json.loads(str(conn.read(), encoding='utf-8'))

and same for the TWLight section

Asuza commented 5 years ago

This same thing is happening to me. @poofyteddy, thanks for the update! I'm hoping to try your tweak soon.

mondul commented 5 years ago

Python 3.5 doesn't support streams on json.load, that's why the minimum required version is 3.6. Changed json.load to json.loads in commit a564c91004979ae8753739f18e30eee7e0a6bc1d . Closing...