AttributeError:'NoneType'对象对Alexa get_slot没有属性'request_envelope'ask-sdk

时间:2019-07-16 23:48:22

标签: python alexa alexa-skills-kit alexa-skill alexa-slot

我正在使用Alexa技能套件,因为我想访问用户所说的文字。我安装了ask-sdk来帮助我做到这一点。以下代码是我从ask-sdk

explode的调用
get_slot

这是我得到的错误:

 28 @ask.intent('MoveIntent')                                                       
 29 def send_action(self, handler_input):                                           
 30     #publish_movement()                                                         
 31     nameVal = get_slot_value(handler_input, slot_name="name")                   
 32     action_msg = 'Taking you to {}'.format(nameVal)                             
 33     return statement(action_msg)  

这发生在File "/Users/aramis/env/lib/python3.7/site-packages/ask_sdk_core/utils/request_util.py", line 214, in get_slot request = handler_input.request_envelope.request AttributeError: 'NoneType' object has no attribute 'request_envelope' 中的get_slot中。 以下是get_slot_value中的代码:

get_slot

有人可以帮助我理解为什么会出现此错误。我不知道什么是无类型对象。

此链接上名为“从请求获取插槽值”的部分说,它使用Alexa sdk对此。 https://developer.amazon.com/docs/custom-skills/handle-requests-sent-by-alexa.html

这是Alexa-sdk的链接 https://alexa-skills-kit-python-sdk.readthedocs.io/en/latest/GETTING_STARTED.html

0 个答案:

没有答案