question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Getting Json Decode error executing the below program-ChatterBot-voice

See original GitHub issue
# from chatterbot import ChatBot
from chatterbot.trainers import ChatterBotCorpusTrainer

bot = ChatBot(
    "Tiberius",
    input_adapter="chatterbot_voice.VoiceInput",
    output_adapter="chatterbot_voice.VoiceOutput",
)

bot.set_trainer(ChatterBotCorpusTrainer)

# Train the chat bot with the entire english corpus
bot.train("chatterbot.corpus.english")

while True:
    try:
        # Use the parameter None because the VoiceInput adapter
        # is getting data from audio input instead of a parameter
        bot_input = bot.get_response(None)
        response=bot.get_response(bot_input)
        print(response)

    # Press ctrl-c or ctrl-d on the keyboard to exit
    except (KeyboardInterrupt, EOFError, SystemExit):
        break

errors:
# ### 
JSONDecodeError                           Traceback (most recent call last)
<ipython-input-4-c59aafb72889> in <module>()
     11 
     12 # Train the chat bot with the entire english corpus
---> 13 bot.train("chatterbot.corpus.english")
     14 
     15 while True:

~\Anaconda3\lib\site-packages\chatterbot\trainers.py in train(self, *corpora)
    115             for data in corpus_data:
    116                 for pair in data:
--> 117                     trainer.train(pair)
    118 
    119 

~\Anaconda3\lib\site-packages\chatterbot\trainers.py in train(self, conversation)
     80 
     81         for text in conversation:
---> 82             statement = self.get_or_create(text)
     83 
     84             if statement_history:

~\Anaconda3\lib\site-packages\chatterbot\trainers.py in get_or_create(self, statement_text)
     23         Create and return the statement if it does not exist.
     24         """
---> 25         statement = self.storage.find(statement_text)
     26 
     27         if not statement:

~\Anaconda3\lib\site-packages\chatterbot\storage\jsonfile.py in find(self, statement_text)
     40 
     41     def find(self, statement_text):
---> 42         values = self.database.data(key=statement_text)
     43 
     44         if not values:

~\Anaconda3\lib\site-packages\jsondb\db.py in data(self, **kwargs)
     96         # If only a key was provided return the corresponding value
     97         if key is not None and value is None:
---> 98             return self._get_content(key)
     99 
    100         # if a key and a value are passed in

~\Anaconda3\lib\site-packages\jsondb\db.py in _get_content(self, key)
     50 
     51     def _get_content(self, key=None):
---> 52         obj = self.read_data(self.path)
     53 
     54         if key or key == "":

~\Anaconda3\lib\site-packages\jsondb\file_writer.py in read_data(file_path)
     13     content = db.read()
     14 
---> 15     obj = decode(content)
     16 
     17     db.close()

~\Anaconda3\lib\site-packages\jsondb\compat.py in decode(value)
     30     from bson import json_util
     31 
---> 32     return json_decode(value, encoding='utf-8', object_hook=json_util.object_hook)
     33 
     34 

~\Anaconda3\lib\json\__init__.py in loads(s, encoding, cls, object_hook, parse_float, parse_int, parse_constant, object_pairs_hook, **kw)
    365     if parse_constant is not None:
    366         kw['parse_constant'] = parse_constant
--> 367     return cls(**kw).decode(s)

~\Anaconda3\lib\json\decoder.py in decode(self, s, _w)
    340         end = _w(s, end).end()
    341         if end != len(s):
--> 342             raise JSONDecodeError("Extra data", s, end)
    343         return obj
    344 

JSONDecodeError: Extra data: line 1 column 1303 (char 1302)

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
jason0luckcommented, Jun 3, 2018

Thank you.finally resolved with this error after updating my chatterbot and deleting the sqlite3 file

0reactions
lock[bot]commented, May 14, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Python JSONDecodeError Explanation and Solution | CK
The Python JSONDecodeError indicates there is an issue with how a JSON object is formatted. To fix this error, you should read the...
Read more >
Why am I receiving this JSON Decode Error? - Stack Overflow
It seems like reddit responses error message as below when you make requests. So it is better to check response status code first....
Read more >
Getting json.decoder.JSONDecodeError while trying ...
Hi All, I am getting the "json.decoder.JSONDecodeError" when I am trying to fetch all jira users using the below python script. Here is...
Read more >
JSONDecodeError when using arcgis.gis.admin.Enterp...
Solved: Hi guys, Im running into a bit of an issue, same with others I saw so far already. My goal is to...
Read more >
Decoding JSON - Part 1 - - Beginning Elm
In Fetching Data Using GET, we learned how to retrieve a simple string from an ... Let's fire up a JSON server by...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found