Skip to content

AttributeError: 'Response' object has no attribute 'status' #46

@Tonemon

Description

@Tonemon
  • Python Alexa Voice Service version: latest
  • Python version: 2.7
  • Operating System: (Respeaker Chaos Calmer v0.9.99)

Description

Hi, I just picked up this project after a while and I am trying to make this script working on boot.
I started with the information from #26 where @xiongyihui said to add it to the autorun.sh file.

What I Did

  • Added these lines to autorun.sh:
echo "executing run_alexa.sh script" > /dev/console
/root/run_alexa.sh &
  • Created new executable file called run_alexa.sh and added the following lines:
#!/bin/sh
cd /root/
echo "run_alexa.sh: changed working dir to:" > /dev/console
pwd > /dev/console


echo "run_alexa.sh: Starting 5 sec sleep process..." > /dev/console
sleep 5

echo "run_alexa.sh: done sleeping, running alexa in screen: sleepyalexa..." > /dev/console
echo "run_alexa.sh: to access this screen, type screen -r" > /dev/console
screen -dm -S sleepyalexa ash -c "alexa"

A new screen is being created at boot with the 'alexa' command and the light ring lights up, but after I say something, the alexa.py script crashes and it loops on this error:

WARNING:avs.alexa:{"error_description":"The request has an invalid grant parameter : refresh_token","error":"invalid_grant"}
WARNING:avs.alexa:{"error_description":"The request has an invalid grant parameter : refresh_token","error":"invalid_grant"}
ERROR:avs.alexa:'Response' object has no attribute 'status'
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/avs/alexa.py", line 110, in run
    self._run()
  File "/usr/lib/python2.7/site-packages/avs/alexa.py", line 129, in _run
    headers = {'authorization': 'Bearer {}'.format(self.token)}
  File "/usr/lib/python2.7/site-packages/avs/alexa.py", line 360, in token
    "refresh token request returned {}".format(response.status))
AttributeError: 'Response' object has no attribute 'status'
INFO:avs.alexa:Refreshing access_token
WARNING:avs.alexa:{"error_description":"The request has an invalid grant parameter : refresh_token","error":"invalid_grant"}
INFO:requests.packages.urllib3.connectionpool:Resetting dropped connection: api.amazon.com
WARNING:avs.alexa:{"error_description":"The request has an invalid grant parameter : refresh_token","error":"invalid_grant"}
WARNING:avs.alexa:{"error_description":"The request has an invalid grant parameter : refresh_token","error":"invalid_grant"}
ERROR:avs.alexa:'Response' object has no attribute 'status'
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/avs/alexa.py", line 110, in run
    self._run()
  File "/usr/lib/python2.7/site-packages/avs/alexa.py", line 129, in _run
    headers = {'authorization': 'Bearer {}'.format(self.token)}
  File "/usr/lib/python2.7/site-packages/avs/alexa.py", line 360, in token
    "refresh token request returned {}".format(response.status))
AttributeError: 'Response' object has no attribute 'status'
INFO:avs.alexa:Refreshing access_token
WARNING:avs.alexa:{"error_description":"The request has an invalid grant parameter : refresh_token","error":"invalid_grant"}
INFO:requests.packages.urllib3.connectionpool:Resetting dropped connection: api.amazon.com
WARNING:avs.alexa:{"error_description":"The request has an invalid grant parameter : refresh_token","error":"invalid_grant"}
WARNING:avs.alexa:{"error_description":"The request has an invalid grant parameter : refresh_token","error":"invalid_grant"}
ERROR:avs.alexa:'Response' object has no attribute 'status'
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/avs/alexa.py", line 110, in run
    self._run()
  File "/usr/lib/python2.7/site-packages/avs/alexa.py", line 129, in _run
    headers = {'authorization': 'Bearer {}'.format(self.token)}
  File "/usr/lib/python2.7/site-packages/avs/alexa.py", line 360, in token
    "refresh token request returned {}".format(response.status))
AttributeError: 'Response' object has no attribute 'status'

Some notes:

  • I can start a new screen from SSH just fine (with screen ash -c "alexa") and deattach from it. Alexa keeps working and I can reattach to it whenever I want.
  • I can start a detached screen from SSH just fine (with screen -dm -S sleepyalexa ash -c "alexa") and Alexa keeps working in the background.

I just can't get it to start at boot without the error above. Does someone know how to fix it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions