insidesherpa / JPMC-tech-task-1-PY3

50 stars 447 forks source link

TypeError: the JSON object must be str, not 'bytes' #90

Open tejas-2232 opened 4 years ago

tejas-2232 commented 4 years ago

I am using Ubuntu 16.04 x64-bit. code is running in the virtual environment, all python3 files and pip are installed. Editor: sublime text

My problem is: Error in running client3.py file Error=> TypeError: the JSON object must be str, not 'bytes'

I have attached screenshots for references. Please help issue_server issue1

tejas-2232 commented 4 years ago

@insidesherpa @anamritraj @marcharper can you help me with this issue?

anamritraj commented 4 years ago

This is because your python version is not updated.

Try updating your python version to at least 3.6 and it should work.

Alternatively, if you want to run this on current version of python you should change this line to

quotes = json.loads(urllib.request.urlopen(QUERY.format(random.random())).read().decode('utf-8'))

Notice this .decode('utf-8') at the end.