Skip to content

problem with default matching using [_] #54

@efremmoraes

Description

@efremmoraes

Creating a very simple template like 'more [_]' causes a TypeError because of an incorrect matching.

Here is the full steps to repeat the problem:

$ cat begin.rive
! version = 2.0

+ *
- I know nothing...

+ more [_]
- more <star>
$ python rivescript-python/rivescript ./
      .   .
     .:...::      RiveScript Interpreter (Python)
    .::   ::.     Library Version: v1.14.2
 ..:;;. ' .;;:..
    .  '''  .     Type '/quit' to quit.
     :;,:,;:      Type '/help' for more options.
     :     :

Using the RiveScript bot found in: ./
Type a message to the bot and press Return to send it.

You> help
Bot> I know nothing...
You> more thing
Bot> more thing
You> more
Traceback (most recent call last):
  File "/usr/local/Cellar/python/2.7.12_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/local/Cellar/python/2.7.12_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/rive-test/rivescript-python/rivescript/__main__.py", line 27, in <module>
    interactive_mode()
  File "/rive-test/rivescript-python/rivescript/interactive.py", line 260, in interactive_mode
    reply = bot.reply("localuser", msg)
  File "/rive-test/rivescript-python/rivescript/rivescript.py", line 999, in reply
    return self._brain.reply(user, msg, errors_as_replies)
  File "/rive-test/rivescript-python/rivescript/brain.py", line 83, in reply
    reply = self._getreply(user, msg, ignore_object_errors=errors_as_replies)
  File "/rive-test/rivescript-python/rivescript/brain.py", line 416, in _getreply
    reply = self.process_tags(user, msg, reply, stars, thatstars, step, ignore_object_errors)
  File "/rive-test/rivescript-python/rivescript/brain.py", line 579, in process_tags
    reply = reply.replace('<star>', stars[1])
TypeError: coercing to Unicode: need string or buffer, NoneType found

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions