Koischizo / AI-Vtuber

AI Livestreamer for Youtube
https://www.youtube.com/watch?v=1MrDnLBc-wQ
MIT License
384 stars 91 forks source link

Unable to open JSON #25

Open Arjester0 opened 1 year ago

Arjester0 commented 1 year ago

Tried executing run command through powershell and gave me an error saying Unable to open JSON how do I fix this?

weihan28 commented 1 year ago

is your api key values at config.json missing double quotation marks? Example: **


# it should be
"keys": [
        {
            "EL_key":  "you key here",
            "OAI_key": "your key here"
        }
  ],
# instead of
"keys": [
        {
            "EL_key":  you key here,  # missing quotation marks right here
            "OAI_key": your key here
        }
  ],
``` **
Arjester0 commented 1 year ago

it is still not working even with the quotations

weihan28 commented 1 year ago

The easiest possibility to fix is an error in the json file, So this is just to make sure that it is indeed not the issue present,

can you see any error messages under the json file?
error messages (PS: this is if you are running it in an IDE like me, see the next comment i made on how to catch it in powershell.)

or if possible, you can post the file here but please do make sure you remove the private keys or other sensitive data that might be present before posting.

weihan28 commented 1 year ago

Detecting these errors might be tricky, since it is in fact not an error code but a print message.

This is code from the run.py file

try:
        with open("config.json", "r") as json_file:
            data = json.load(json_file)
except:
        print("Unable to open JSON file.") # it just prints a statement without printing the error message
        exit()

If i modify this code,

try:
      with open("config.json", "r") as json_file:
          data = json.load(json_file)
except Exception as e:
      print(e)
      print("Unable to open JSON file.")
      exit()

it gives me

Invalid control character at: line 4 column 58 (char 83). # this is the real error code
Unable to open JSON file.
weihan28 commented 1 year ago

@Sylensar maybe this one might interest you. It already supports twitch chat. https://github.com/ardha27/AI-Waifu-Vtuber