本文整理汇总了Python中brain.Brain.save_session方法的典型用法代码示例。如果您正苦于以下问题:Python Brain.save_session方法的具体用法?Python Brain.save_session怎么用?Python Brain.save_session使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类brain.Brain
的用法示例。
在下文中一共展示了Brain.save_session方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Brain
# 需要导入模块: from brain import Brain [as 别名]
# 或者: from brain.Brain import save_session [as 别名]
os.path.join(os.path.dirname(os.path.realpath(__file__)), "../../little_alice/modules")
)
brains_dir = os.path.realpath(
os.path.join(os.path.dirname(os.path.realpath(__file__)), "../../little_alice/brains")
)
brain = Brain(modules_dir, brains_dir)
brain.load_brain()
brain.load_session()
try:
while True:
print "zero-brain subscribed to nervous system"
message = sock.recv()
print "receive "+message
clean_message = message.replace(ear_perceive_channel, "", 1)
brain_response = brain.kernel.respond(clean_message, brain.session_name)
if brain_response:
print "sending: "+brain_say_channel+brain_response
publish_sock.send(brain_say_channel+brain_response)
print "zero-brain did his job"
except KeyboardInterrupt:
pass
finally:
brain.save_session()