Error trying to create new module and subscribe using ALAudioDevice service - python

I have been trying to run a python script to get Nao's audio as a stream
Found the example directly on aldebaran's website
http://doc.aldebaran.com/2-8/dev/python/examples/audio/audio_soundprocessing.html#process-microphone-signals
I am trying to run it as is with only my robot's proper IP. Once it gets to the startProcessing function, it cannot find the new service created in ALAudioDevice and gives the following error
self.audio_service.setClientPreferences(self.module_name, 16000, 3, 0)
RUNTIMEERROR: ALPROXY::ALPROXY
CANT FIND SERVICE: SoundProcessingModule
[W] 1609782681.228570 42712 QITYPE.SIGNAL: DISCONNECT: NO SUBSCRIPTION FOUND FOR SIGNALLINK 14.
Any idea of what should change to be able to run that example?

As you can see in the link you provided, prior to setting the audio client preferences, you must register your service (or "module") to NAOqi:
app.session.listen()
app.session.registerService("SoundProcessingModule", MySoundProcessingModule)
It is important that your service is registered prior to referring to it in other APIs such as setClientPreferences.

Related

ToDoist API Python SDK throwing 410 Error

Background: I'm trying to write a Python script that creates a task in ToDoist using their REST API Python SDK, based on the charge percentage of my dog's Fi Collar (obtained via Pytryfi). Basically, if the Fi collar's battery falls below a certain threshold, create a new task.
Problem: A 401 error is returned when trying to use the todoist_api_python SDK, copied exactly from Todoist's website.
Following these instructions, I was able to install todoist-api-python, but when I run this code (using a real API key):
pip install todoist-api-python
from todoist_api_python.api import TodoistAPI
api = TodoistAPI("XXXXXXX")
try:
projects = api.get_projects()
print(projects)
except Exception as error:
print(error)
I receive this error:
410 Client Error: Gone for url: https://api.todoist.com/rest/v1/projects
I do know there has been a recent change from v1->v2 of this API, and indeed when I put the URL above from the error message in to a browser with ../v2/projects, I see a list of my tasks.
I don't know how to make the todoist-api-python SDK point to the new URL. I'd really appreciate any help you can offer! Thanks!
Be sure you're using the version 2 of todoist-api-python, as this is the one that uses the latest version of the API: https://pypi.org/project/todoist-api-python/
You're probably using an old version that relies on REST API v1.

Azure functions Error: Error "SyntaxError: Unexpected token S in JSON at position 0" occurred while parsing the response body - Service Unavailable

I am getting the error while deploying the Azure function from the local system.
I wen through some blogs and it is stating that my function is unable to connect with the Azure storage account which has the functions meta data.
Also, The function on the portal is showing the error as: Azure Functions runtime is unreachable
Earlier my function was running but after integrating the function with a Azure premium App service plan it has stooped working. My assumption is that my app service plan having some restriction for the inbound/outbound traffic rule and Due to this it is unable to establish the connection with the function's associated storage account.
Also, I would like to highlight that if a function is using the premium plan then we have to add few other configuration properties.
WEBSITE_CONTENTAZUREFILECONNECTIONSTRING = "DefaultEndpointsProtocol=https;AccountName=blob_container_storage_acc;AccountKey=dummy_value==;EndpointSuffix=core.windows.net"
WEBSITE_CONTENTSHARE = "my-function-name"
For the WEBSITE_CONTENTSHARE property I have added the function app name but I am not sure with the value.
Following is the Microsoft document reference for the function properties
Microsoft Function configuration properties link
Can you please help me to resolve the issue.
Note: I am using python for the Azure functions.
I have created a new function app with Premium plan and selected the interpreter as Python. When we select Python, OS will be automatically Linux.
Below is the message we get to create functions for Premium plan function App:
Your app is currently in read only mode because Elastic Premium on Linux requires running from a package.
PortalScreenshot
We need to create, deploy and run function apps from a package, refer to the documentation on how we can run functions from package.
Documentation
Make sure to add all your local.settings.json configurations to Application Settings in function app.
Not sure of what kind of Azure Function you are using but usually when there is a Storage Account associated, we need to specify the AzureWebJobsStorage field in the serviceDependencies.json file inside Properties folder. And when I had faced the same error, the cause was that while publishing the azure function from local, some settings from the local.settings.json were missing in the Application Settings of the app service under Configuration blade.
There can be few more things which you can recheck:
Does the storage account you are trying to use existing still or is deleted by any chance.
While publishing the application from local, using the web deploy method, the publish profile is correct or has any issues.
Disabling the function app and then stopping the app service before redeploying it.
Hope any of the above mentions help you diagnose and solve the issue.
The thing is that there is a difference in how the function deployed using Consumption vs Premium service plan.
Consumption - working out of the box.
Premium - need to add the WEBSITE_RUN_FROM_PACKAGE = 1 in the function Application settings. (see https://learn.microsoft.com/en-us/azure/azure-functions/run-functions-from-deployment-package for full details)

python-openstacksdk user and tenant creation (create user, create project and allocate quota)

I want to use python API to create a User and project, assign that user to the project created and then allocate certain quota. I can't find documentation for this. What is the best way to do these tasks using code (cant do it with CLI).
Thanks.
Error : 'Proxy' object has no attribute 'v2'
Code:
from openstack import connection
import openstack
conn = connection.Connection(auth_url="https://example.com/v2.0",
project_name="admin",
username="admin",
password="test", verify=False)
conn.identity.v2._proxy.create_role()
Documentation URL : https://developer.openstack.org/sdks/python/openstacksdk/users/proxies/identity_v2.html
I have not tried openstack user/domain/project creation using python directly. But the openstack cli in turn uses the python APIs only.
The CLI command actually imports the python module 'openstackclient'.
So digging further into this may help you.
The default location where openstack client installed is
/usr/lib/python2.7/dist-packages/openstackclient/

appium ios python "an error occured while executing user supplied javascript"

I'm using a bit Appium (v1.3.7) to make nice tests! And I'm trying to have tests that runs on both Android and iOS. I'm testing directly on the phones not on simulators and using python to write tests.
I got a test to test if an ad banner is displayed and if I can click on it.
Simple enough on Android I open the application and navigate to the right place, then send a press event and assert that the elements of my application are no longer visible (since now we have the phone store openned at "download application" or something similar)
It's 2 lines:
e1 = TouchAction(self.webdriver)
e1.press(x=300, y=1200).release().perform()
It's working on Android, but on iOS it returns the exception : "an error occured while executing user supplied javascript" whenever I call the perform action.
All of this is done in a native application if it can help. The rest of appium is working fine I can move into my application and all but since here my ads can be pretty random I only had the "press where the ad should be" solution.
Also fruitsrap keep failing whenever I launch a test. Might be linked even if I found out that it should not be used anymore (https://github.com/appium/appium/issues/4501)
Do anyone knows what's happening in there?
Figured what was wrong, the x and y positions were out of bound, the screen resolution of the phone was smaller than I thought.
It's working properly with in bound values. But the error message should be more explicit :)

Pepper API error during the example

I'm starting to play around with the new Pepper API for an important project (phasing out Java) and I'm having an issue with this example.
https://developer.chrome.com/native-client/devguide/devcycle/vs-addin
I've installed the plugin to VS, added the paths, started the python webserver yet when I debug it gives me a 404...
I'm starting the python webserver as per https://developer.chrome.com/native-client/sdk/examples
The issue being the HTML file it's looking for is in F:\nacl_sdk\vs_addin\examples\hello_world_gles\hello_world_gles and the localhost root is F:\nacl_sdk\pepper_42\getting_started
Has anyone else had this issue?
I also have plenty of intellisense errors:
Since I posted this I tried copying the example directory to the root directory being used by localhost. The page loads, however I'm not capable of running the plugin...
I think you're not supposed to be starting the Python web server, as per the vs addin documentation:
When you run one of the Native Client platforms Visual Studio builds
the corresponding type of Native Client module (either a .nexe or
.pexe), starts a web server to serve it up, and launches a copy of
Chrome that fetches the module from the server and runs it.
However, to be honest, I'm still unable to run this sample, even though I'm following this instruction. I'm seeing an "ERR_CONNECTION_REFUSED" result page. I'm using VS 2012 Express, and Chrome 43.
Update. I've finally managed to run the sample. First, I've installed VS 2012 Ultimate instead of Express (because Express doesn't support Add-Ins). Second, the latest VS addin seems to be unable to run the Python web-server, it passes the port paramater in a wrong format. You can see that if you read the output in the "Native Client Web Server Output" pane in VS. So what I did, is I modified the %NACL_SDK_ROOT%\tools\httpd.py, so that it doesn't attempt to parse the command line arguments :)
Here is the new main from my httpd.py:
def main(args):
server = LocalHTTPServer(os.path.abspath('.'), 5103)
# Serve until the client tells us to stop. When it does, it will give us an
# errorcode.
print 'Serving %s on %s...' % (options.serve_dir, server.GetURL(''))
return server.ServeForever()
HTH.

Categories