我正在通过使用 Alexa 语音控制来控制覆盆子 gpio 引脚来开发 Alexa 自定义技能,我遵循了这里提到的每一个步骤https://www.instructables.com/id/Control-Raspberry-Pi-GPIO-With-Amazon -Echo-and-Pyt/但这给了我响应错误
我尝试将密码学降级到 2.2。重新启动服务器。重新构建模型。
logging.getLogger("flask_ask").setLevel(logging.DEBUG)
@ask.intent('GPIOControlIntent', mapping={'status': 'status', 'pin': 'pin'})
def gpio_control(status, pin):
try:
pinNum = int(pin)
except Exception as e:
return statement('Pin number not valid.')
GPIO.setup(pinNum, GPIO.OUT)
if status in ['on', 'high']: GPIO.output(pinNum, GPIO.HIGH)
if status in ['off', 'low']: GPIO.output(pinNum, GPIO.LOW)
return statement('Turning pin {} {}'.format(pin, status))
我得到的错误:
127.0.0.1 - - [13/Jul/2019 00:04:25] "POST / HTTP/1.1" 500 - Traceback (most recent call last): File "/home/pi/.local/lib/python2.7/site-packages/flask/app.py", line 1997, in __call__
return self.wsgi_app(environ, start_response) File "/home/pi/.local/lib/python2.7/site-packages/flask/app.py", line 1985, in wsgi_app
response = self.handle_exception(e) File "/home/pi/.local/lib/python2.7/site-packages/flask/app.py", line 1540, in handle_exception
reraise(exc_type, exc_value, tb) File "/home/pi/.local/lib/python2.7/site-packages/flask/app.py", line 1982, in wsgi_app
response = self.full_dispatch_request() File "/home/pi/.local/lib/python2.7/site-packages/flask/app.py", line 1614, in full_dispatch_request
rv = self.handle_user_exception(e) File "/home/pi/.local/lib/python2.7/site-packages/flask/app.py", line 1517, in handle_user_exception
reraise(exc_type, exc_value, tb) File "/home/pi/.local/lib/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request
rv = self.dispatch_request() File "/home/pi/.local/lib/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args) File "/home/pi/.local/lib/python2.7/site-packages/flask_ask/core.py", line 728, in _flask_view_func
ask_payload = self._alexa_request(verify=self.ask_verify_requests) File "/home/pi/.local/lib/python2.7/site-packages/flask_ask/core.py", line 662, in _alexa_request
cert = verifier.load_certificate(cert_url) File "/home/pi/.local/lib/python2.7/site-packages/flask_ask/verifier.py", line 21, in load_certificate
if not _valid_certificate(cert): File "/home/pi/.local/lib/python2.7/site-packages/flask_ask/verifier.py", line 63, in _valid_certificate
value = str(extension) File "/home/pi/.local/lib/python2.7/site-packages/OpenSSL/crypto.py", line 779, in __str__
return self._subjectAltNameString() File "/home/pi/.local/lib/python2.7/site-packages/OpenSSL/crypto.py", line 740, in _subjectAltNameString
method = _lib.X509V3_EXT_get(self._extension) AttributeError: 'module' object has no attribute 'X509V3_EXT_get'
127.0.0.1 - - [13/Jul/2019 00:04:28] "POST / HTTP/1.1" 500 - Traceback (most recent call last): File "/home/pi/.local/lib/python2.7/site-packages/flask/app.py", line 1997, in __call__
return self.wsgi_app(environ, start_response) File "/home/pi/.local/lib/python2.7/site-packages/flask/app.py", line 1985, in wsgi_app
response = self.handle_exception(e) File "/home/pi/.local/lib/python2.7/site-packages/flask/app.py", line 1540, in handle_exception
reraise(exc_type, exc_value, tb) File "/home/pi/.local/lib/python2.7/site-packages/flask/app.py", line 1982, in wsgi_app
response = self.full_dispatch_request() File "/home/pi/.local/lib/python2.7/site-packages/flask/app.py", line 1614, in full_dispatch_request
rv = self.handle_user_exception(e) File "/home/pi/.local/lib/python2.7/site-packages/flask/app.py", line 1517, in handle_user_exception
reraise(exc_type, exc_value, tb) File "/home/pi/.local/lib/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request
rv = self.dispatch_request() File "/home/pi/.local/lib/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args) File "/home/pi/.local/lib/python2.7/site-packages/flask_ask/core.py", line 728, in _flask_view_func
ask_payload = self._alexa_request(verify=self.ask_verify_requests) File "/home/pi/.local/lib/python2.7/site-packages/flask_ask/core.py", line 662, in _alexa_request
cert = verifier.load_certificate(cert_url) File "/home/pi/.local/lib/python2.7/site-packages/flask_ask/verifier.py", line 21, in load_certificate
if not _valid_certificate(cert): File "/home/pi/.local/lib/python2.7/site-packages/flask_ask/verifier.py", line 63, in _valid_certificate
value = str(extension) File "/home/pi/.local/lib/python2.7/site-packages/OpenSSL/crypto.py", line 779, in __str__
return self._subjectAltNameString() File "/home/pi/.local/lib/python2.7/site-packages/OpenSSL/crypto.py", line 740, in _subjectAltNameString
method = _lib.X509V3_EXT_get(self._extension) AttributeError: 'module' object has no attribute 'X509V3_EXT_get'