ikramelgharbi / chatter-bot-api

Automatically exported from code.google.com/p/chatter-bot-api
0 stars 0 forks source link

IndexError: list index out of range in chatterbotapi.py #12

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Use chatterbotapi with telegram 
(https://github.com/asdofindia/python-telegram-bot)
2. chat with bot
3. crash:

Exception in thread Thread-1:
Traceback (most recent call last):
File "/usr/lib64/python2.7/threading.py", line 811, in __bootstrap_inner
self.run()
File "/usr/lib64/python2.7/threading.py", line 764, in run
self.__target(*self.__args, **self.__kwargs)
File "bot.py", line 178, in bot
AI(group,peer,message)
File "bot.py", line 84, in AI
reply=callmodule(message,peer)
File "bot.py", line 62, in callmodule
reply = botsessions[peer].think(message)
File ".../python-telegram-bot/chatterbotapi.py", line 58, in think
return self.think_thought(thought).text
File "/.../python-telegram-bot/chatterbotapi.py", line 152, in think_thought
response_thought.text = 
response_dom.getElementsByTagName('that')[0].childNodes[0].data.strip()
IndexError: list index out of range

What is the expected output? What do you see instead?
No output, just chat :)

What version of the product are you using? On what operating system?
Python2 and Linux (Fedora)

Please provide any additional information below.

I am using your API with Telegram: 
https://github.com/asdofindia/python-telegram-bot

Original issue reported on code.google.com by ufa.og...@gmail.com on 8 Oct 2014 at 5:11

GoogleCodeExporter commented 8 years ago
I appreciate to took your time to file this issue.
I will try to have a look at it today or tomorrow.

Are you able to reproduce the bug using only my lib (directly, without 
python-telegram-bot) ?

Thank you.

Original comment by pierredavidbelanger@gmail.com on 8 Oct 2014 at 5:40

GoogleCodeExporter commented 8 years ago
Thank you for your attention on this issue.
Just to add some info, the problem occurs after some chat time, with a
Pandora setting. It's like a buffer overflow of some kind.
On a side note, I don't know how to try it all by itself.
Thanks again
Am 08.10.2014 14:40 schrieb <chatter-bot-api@googlecode.com>:

Original comment by ufa.og...@gmail.com on 8 Oct 2014 at 7:54

GoogleCodeExporter commented 8 years ago
It looks like it was an empty response that cause an list index out of range.

I've committed a fix.

Here is the commit:
https://code.google.com/p/chatter-bot-api/source/detail?r=50

Here is the new source revision:
https://code.google.com/p/chatter-bot-api/source/browse/#svn%2Ftags%2Fpython-1.3
.1

The new compiled revision is in the Downloads section:
https://code.google.com/p/chatter-bot-api/wiki/Downloads?tm=2

Original comment by pierredavidbelanger@gmail.com on 10 Oct 2014 at 1:22