anjishnu / ask-alexa-pykit

A minimalist SDK for developing skills for the Amazon Echo's ASK - Alexa Skills Kit using Amazon Web Services's Python Lambda Functions. Currently supported profiles are for Linux servers and AWS Lambda. Check the appropriate release branch. The cherrypy release branches have added components for request validation.
MIT License
275 stars 58 forks source link

VoiceHandler error when deploying to Lambda #30

Open mwheeler1982 opened 7 years ago

mwheeler1982 commented 7 years ago

When I attempt to deploy my very simple Alexa skill to Lambda and test it, I get the following error in the logs:

module initialization error: 'VoiceHandler' object has no attribute 'default'

What information can I provide to help troubleshoot?

ysak-y commented 7 years ago

I guess you implement Skill by reference to README.md.

$ pip install ask-alexa-pykit --target my_new_skill installs older(?) library.

You should open ask/alexa_io.py and search default_handler.

If match, you must replace your Alexa Skill default to default_handler, request to request_handler, intent to intent_handler.

It will be work.

anjishnu commented 7 years ago

Did you try what ysak recommended? I have some half finished dialogue management features on mainline. Try one of the stable releases.

planux commented 7 years ago

I had the same problem when doing a pip install ask-alexa-pykit --target pl_alex_test --upgrade

The PKGINFO for that read:

Metadata-Version: 1.0
Name: ask-alexa-pykit
Version: 0.5.6
Summary: Minimalist SDK for developing skills for Amazon's Alexa Skills Kit for Amazon Echo Dot Tap FireTV etc
Home-page: https://github.com/anjishnu/ask-alexa-pykit
Author: Anjishnu Kumar
Author-email: anjishnu.kr@gmail.com
License: MIT
Description: UNKNOWN
Keywords: alexa,amazon echo,ask,ask-alexa-pykit,skill
Platform: UNKNOWN

It is noted on the homepage that:

For a stable release, check out the 0.5.6 branch

Following the instructions @ysak-y provided did resolve the problem (and helped me to better understand the way that the @ symbol works in Python!).

Note that when I grabbed a copy of the files from master and tried out the examples, I got a different error about default requiring 2 parameters -- self and func. I switched back to the 0.5.6 version installed via pip, applied @ysak-y's instructions and it worked fine.

mickster04 commented 7 years ago

Just in case anyone else missed it.

@alexa.default()
def default_handler(request):

should change to

@alexa.default_handler()
def default_handler(request):

etc etc. in your python scripts, the method name itself isn't relevant to this issue.