I am using Google Collaboration for the sample code provided by Sony.
I ran the last sentence with $python execute_action_api.py find_object"{\"TargetType\":\"pinkball\"}"
, and found that
File"<ipython-input-21-cd227b9f8d7e>", line54$python execute_action_api.py find_object"{\"TargetType\":\"pinkball\"}}"^SyntaxError:invalid syntax
The error appears.Where should I fix it?
By the way, I have not changed anything other than getting the access token and deviceId, and I have just pasted it.
Sample Code:
https://developer.aibo.com/jp/docs#%E3%82%B5%E3%83%B3%E3%83%97%E3%83%AB%E3%82%B3%E3%83%BC%E3%83%89
lOn line 54, SyntaxError: invalid syntax
, so I should look at line 54...
Google Colab is a Jupiter notebook on the cloud, isn't it? Enter a sample program into the Code cell and
python execute_action_api.py find_object "{\"TargetType\":\"pinkball\"}"
You have added and tried to execute .
Running that code cell should not run find_object
.
This is because sys.argv[1] is not find_object
.
if__name__==
Why don't you comment out (or delete) the following and call them directly with appropriate arguments for the do_action
function?
""
if__name__=='__main__':
length = len(sys.argv)
if length == 3:
do_action(sys.argv[1], sys.argv[2])
else:
print("execute_action_api.py<action apiname><parameters>")
exit(1)
"""
do_action("find_object", "{\"TargetType\":\"pinkball\"}")
When I tried it here, it turned out to be Timeout. At least there will be no syntax error.
I tried it myself.
As someone else wrote, remove the following which is not required on Google Collection and
if__name__=='__main__':
length = len(sys.argv)
if length == 3:
do_action(sys.argv[1], sys.argv[2])
else:
print("execute_action_api.py<action apiname><parameters>")
exit(1)
Replace with the location where you deleted the above.
do_action("play_motion", "{\"Category\":\"bark\",\"Mode\":\"NONE\"}")
I think aibo will respond if you add something like that and so on.(This is a one-time buzzing motion)
If an error occurs, please include the correct string obtained by looking at the reference link in the following areas:
headers={
'Authorization': 'Bearer put token string (quite long) here',
}
BASE_PATH='https://public.api.aibo.com/v1'
DEVICE_ID = "Insert device ID here"
https://developer.aibo.com/jp/docs#Get Access Tokens
When timeouts occur, we could avoid them by setting TIME_OUT_LIMIT=10 to a larger value such as 100.
© 2024 OneMinuteCode. All rights reserved.