Skip to content
This repository has been archived by the owner on Aug 3, 2023. It is now read-only.

New update json.decoder.JSONDecodeError #4

Closed
leolrg opened this issue Feb 10, 2023 · 29 comments
Closed

New update json.decoder.JSONDecodeError #4

leolrg opened this issue Feb 10, 2023 · 29 comments

Comments

@leolrg
Copy link

leolrg commented Feb 10, 2023

raceback (most recent call last):
  File "/Users/leolrg/Library/Python/3.9/lib/python/site-packages/requests/models.py", line 971, in json
    return complexjson.loads(self.text, **kwargs)
  File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/leolrg/Downloads/EdgeGPT/src/EdgeGPT.py", line 135, in __init__
    self.struct = response.json()
  File "/Users/leolrg/Library/Python/3.9/lib/python/site-packages/requests/models.py", line 975, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/leolrg/Downloads/EdgeGPT/src/EdgeGPT.py", line 293, in <module>
    asyncio.run(main())
  File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/Users/leolrg/Downloads/EdgeGPT/src/EdgeGPT.py", line 254, in main
    bot = Chatbot()
  File "/Users/leolrg/Downloads/EdgeGPT/src/EdgeGPT.py", line 203, in __init__
    self.chat_hub: ChatHub = ChatHub(Conversation())
  File "/Users/leolrg/Downloads/EdgeGPT/src/EdgeGPT.py", line 137, in __init__
    raise Exception(
TypeError: __init__() missing 3 required positional arguments: 'msg', 'doc', and 'pos'
@PetterZhukov
Copy link

I also met this problem

@PetterZhukov
Copy link

raceback (most recent call last):
  File "/Users/leolrg/Library/Python/3.9/lib/python/site-packages/requests/models.py", line 971, in json
    return complexjson.loads(self.text, **kwargs)
  File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/leolrg/Downloads/EdgeGPT/src/EdgeGPT.py", line 135, in __init__
    self.struct = response.json()
  File "/Users/leolrg/Library/Python/3.9/lib/python/site-packages/requests/models.py", line 975, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/leolrg/Downloads/EdgeGPT/src/EdgeGPT.py", line 293, in <module>
    asyncio.run(main())
  File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/asyncio/runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "/Applications/Xcode.app/Contents/Developer/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete
    return future.result()
  File "/Users/leolrg/Downloads/EdgeGPT/src/EdgeGPT.py", line 254, in main
    bot = Chatbot()
  File "/Users/leolrg/Downloads/EdgeGPT/src/EdgeGPT.py", line 203, in __init__
    self.chat_hub: ChatHub = ChatHub(Conversation())
  File "/Users/leolrg/Downloads/EdgeGPT/src/EdgeGPT.py", line 137, in __init__
    raise Exception(
TypeError: __init__() missing 3 required positional arguments: 'msg', 'doc', and 'pos'

#2 let‘s see this issue,it solve the same problem

@leolrg
Copy link
Author

leolrg commented Feb 10, 2023

let‘s see this issue,it solve the same problem

No that one is the old version where you need your own Cookies.

@leolrg
Copy link
Author

leolrg commented Feb 10, 2023

run python -m EdgeGPT "MY_COOKIES" and get same as error above.

You ran into the same problem even with your own cookies that has beta access?

@PetterZhukov
Copy link

it may be solved if you get access ,I guess; I have joined the waitlist,too. And I met the same problem

@leolrg
Copy link
Author

leolrg commented Feb 10, 2023

it may be solved if you get access ,I guess; I have joined the waitlist,too. And I met the same problem

The new version is supposed to use someone else's shared account that has the beta access so we do not need to use our own cookies.

@PetterZhukov
Copy link

it may be solved if you get access ,I guess; I have joined the waitlist,too. And I met the same problem

The new version is supposed to use someone else's shared account that has the beta access so we do not need to use our own cookies.

oh I know,is 'python -m EdgeGPT' ?I try it and met the same error ,too. Yes, there may be other reasons

@acheong08
Copy link
Owner

Hello. The reason is because it didn't update properly

@acheong08
Copy link
Owner

You have to completely uninstall it and reinstall

pip3 uninstall EdgeGPT

pip3 install EdgeGPT

@acheong08
Copy link
Owner

Python caches are weird

@acheong08
Copy link
Owner

run python -m EdgeGPT "MY_COOKIES" and get same as error above.

This means your cookies aren't valid. Just run it as python3 -m EdgeGPT without any other agruments

@leolrg
Copy link
Author

leolrg commented Feb 10, 2023

You have to completely uninstall it and reinstall
pip3 uninstall EdgeGPT
pip3 install EdgeGPT

Didn't work. I even downloaded the repository and use it instead of the pip version but got the same error.

@acheong08
Copy link
Owner

Didn't work. I even downloaded the repository and use it instead of the pip version but got the same error.

git clone https://github.com/acheong08/EdgeGPT
cd EdgeGPT
pip3 install .

Is that how you did it?

@leolrg
Copy link
Author

leolrg commented Feb 10, 2023

Is that how you did it?

I download the repository and

cd EdgeGPT/src
python3 EdgeGPT.py

@acheong08
Copy link
Owner

Yeah, don't do that. Just pip3 install . inside the directory and python3 -m EdgeGPT

If you have it cloned, remember to git pull

@acheong08
Copy link
Owner

I update very frequently so always update to the latest version

@PetterZhukov
Copy link

python3 -m EdgeGPT

I re-pip the moduel ,but I still met this error, that's so bad

@Jimmy-Z
Copy link

Jimmy-Z commented Feb 10, 2023

I did a little debug, and I think I've found the bug: just remove br from accept-encoding header.

explanation:

  • AFAICT requests doesn't handle brotli
  • bing doesn't actually use brotli so it's fine if you're using your own cookie
  • but the shared service will

@leolrg
Copy link
Author

leolrg commented Feb 10, 2023

I did a little debug, and I think I've found the bug: just remove br from accept-encoding header.

Thanks! it worked!

@zjrwtx
Copy link

zjrwtx commented Feb 10, 2023

I did a little debug, and I think I've found the bug: just remove br from accept-encoding header.

explanation:

  • AFAICT requests doesn't handle brotli
  • bing doesn't actually use brotli so it's fine if you're using your own cookie
  • but the shared service will

image
i have tried it ,but it still not works,is it my error?

@Jimmy-Z
Copy link

Jimmy-Z commented Feb 10, 2023

Are you using your own cookie? are you still on the waitlist?

@zjrwtx
Copy link

zjrwtx commented Feb 10, 2023

Are you using your own cookie? are you still on the waitlist?

i use the public server,Without a cookie

Jimmy-Z added a commit to Jimmy-Z/EdgeGPT that referenced this issue Feb 10, 2023
wrong accept-encoding header acheong08#4 (comment)
JSONDecodeError was raised wrong
@KyleZhang0536
Copy link

KyleZhang0536 commented Feb 10, 2023

I did a little debug, and I think I've found the bug: just remove br from accept-encoding header.

Works for me

@Jimmy-Z
Copy link

Jimmy-Z commented Feb 10, 2023

Are you using your own cookie? are you still on the waitlist?

i use the public server,Without a cookie

Try my fork (or wait for my pr to be merged), should have a more informational exception output
https://github.com/Jimmy-Z/EdgeGPT

@Jimmy-Z Jimmy-Z mentioned this issue Feb 10, 2023
Closed
@zjrwtx
Copy link

zjrwtx commented Feb 10, 2023

Are you using your own cookie? are you still on the waitlist?

i use the public server,Without a cookie

Try my fork (or wait for my pr to be merged), should have a more informational exception output https://github.com/Jimmy-Z/EdgeGPT

thanks,it works

@acheong08
Copy link
Owner

I did a little debug, and I think I've found the bug: just remove br from accept-encoding header.

Works for me

That's interesting. Might be a difference in our request versions. I'm fixing now

@acheong08
Copy link
Owner

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants
@Jimmy-Z @KyleZhang0536 @acheong08 @PetterZhukov @zjrwtx @leolrg and others