Open zanylane opened 6 years ago
Hi, some things to check:
Thank you for your reply.
As for the other two points, it wasn't complaining that it couldn't find lambda. I commented out the lines wanting to validate the v3 json, and the code runs now. It just seemed like it could be a good idea to have that validation, just in case. (But since it's only code from Amazon's that I'm allowing inbound, I don't know how much of a risk it is.)
Thank you for your time! It really seems like their example code should run 'out of the box' but I don't know enough Python and how it treats imports to really understand it. I spent quite a while trying to puzzle it out, but I don't have enough time right now and was hoping that for an expert it would just be obvious.
Within the 'jsonschema' subfolder, there is a file 'validators.py' that contains the 'validate' method. There is a ' init .py' (no spaces, but the forum code was eating it and making the init render as bold) file in the jsonschema folder that has this: from jsonschema.validators import ( Draft3Validator, Draft4Validator, RefResolver, validate )
Here's the function, from the end of validators.py:
def validate(instance, schema, cls=None, *args, *kwargs): if cls is None: cls = validator_for(schema) cls.check_schema(schema) cls(schema, args, **kwargs).validate(instance)
So I really don't see why it would be failing. At least for now, I've given up on validation, until I can figure this out and fix it.
I'm working my way through the guide here: https://github.com/alexa/alexa-smarthome/wiki/Build-a-Working-Smart-Home-Skill-in-15-Minutes
I have everything set up, and when I ask Alexa to discover devices, all I get is an error in the logs:
Unable to import module 'lambda': cannot import name 'validate'
If I change the Python version to 2.7 then it can't even find the module jsonschema. Is there some other thing that I'm doing wrong? I can provide plenty of extra details, but really, I just went step by step through that guide, and it's just not working, although I have everything connected, and was able to enable the skill from the Alexa app on my phone. (Also can do it through the web interface from my PC, but either way seems the same result. Python can't find that method for some reason.)
Thanks!