recognize_google gives "recognition request failed: Forbidden" error - virtual-machine

I am using an Ubuntu 20.04 Virtual Machine and running the following code :
import speech_recognition as sr
# Initialize recognizer class (for recognizing the speech)
r = sr.Recognizer()
# Reading Audio file as source
# listening the audio file and store in audio_text variable
with sr.AudioFile('I-dont-know.wav') as source:
audio_text = r.listen(source)
# recoginize_() method will throw a request error if the API is unreachable, hence using exception handling
try:
# using google speech recognition
text = r.recognize_google(audio_text)
print('Converting audio transcripts into text ...')
print(text)
except Exception as ex:
print(ex)
It gives the error message "recognition request failed: Forbidden"
I have also tried generating a key from google cloud and setting its path on the device but still the same error occurs.
If anyone can suggest something, it would be great help. Any alternate and efficient methods for speech to text conversion can also be suggested.
Thanks

Related

Moodle File Upload errors: An error occured whilst communicating with the server

With some Uploads in Moodle (3.9) Uploads are not successful, mainly pdf.
The message that comes up is: "An error occured whilst communicating with the server".
not successful requests show
POST /course/dndupload.php undefined
successful requests show
POST /course/dndupload.php HTTP/1.1
When a pdf is reexported with libre office for example the same pdf can be uploaded without problems.
any ideas?
Is the LibreOffice pdf smaller? It could be PHP timing out.
https://docs.moodle.org/311/en/File_upload_size#Modifying_the_php.ini_file
What is the value for max_execution_time ? You can check the PHP values here -
Site administration > Server > PHP info
Also, try switching debug to developer level and see what the error message is.
Site administration > Development > Debugging
Debug messages = Developer
Display debug messages = checked
Although be cautious changing the debug level if its a production site. If you have access to the config.php file then you can specify a user.
// You can specify a comma separated list of user ids that that always see
// debug messages, this overrides the debug flag in $CFG->debug and $CFG->debugdisplay
// for these users only.
// $CFG->debugusers = '2';
Thanks for the response, in the meantime a solution to the problem was found. On the server a measurement against log4j2-vulnerability has been implemented: https://support.f5.com/csp/article/K59329043#proc2. This caused the misbehaviour, the iRule has been removed, now it works again.

Downloading SetupTools in Maximo/Jython fails with HTTP error 403 SSL is required

Appendix A of The Definitive Guide to Jython describes downloading SetupTools for use with Jython.
https://jython.readthedocs.io/en/latest/appendixA/
This indicates to me that it should be possible to download and use SetupTools from within a Jython automation script in Maximo (v7.6 in my case). The book points us to the following url to copy a Jython script that will do this:
http://peak.telecommunity.com/dist/ez_setup.py
I add one line to the above script to call the function "use_setuptools":
use_setuptools()
Then I create a push button on a Maximo application and associate the aforementioned script with the button press I get the following error:
System Message BMXAA7837E - An error occured that prevented the
EZ_SETUP script for the EZ_SETUP launch point from running.
urllib2.HTTPError: HTTP Error 403: SSL is required in at line
number 280
The stack trace points to the following line in the function "download_setuptools" which is called by "use_setuptools":
src = urllib2.urlopen(url)
This appears to be because the url requested, in my case:
http://pypi.python.org/packages/2.5/s/setuptools/setuptools-0.6c11-py2.5.egg
...is redirected a few times before arriving at the following url:
https://files.pythonhosted.org/packages/98/d3/ed3bc7e3f4b143092862dab99d984261ac4be6a40d4fb1e66d2a10e9ea99/setuptools-0.6c11-py2.5.egg
Note the url uses HTTPS not HTTP. The following indicates why this may be so:
https://sourceforge.net/p/pypi/support-requests/300/
The jython.jar included with Maximo does not include the ssl module so we could either:
Download the ssl module manually and copy it to the correct location on the server.
Download the appropriate egg file manually over HTTPS and copy it to the correct location on the server.
Bypass the problem by creating a mirror for the file we're looking for that is accessible over HTTP and use that url in the code.
Whilst these are feasible I'd prefer to modify the code to ignore the SSL certificate if possible, however all the workarounds on StackOverflow and elsewhere seem to require that you're able to "import ssl" in order to bypass it which rather seems to defeat the purpose.
Ideally I'm looking for a solution that modifies the code from the url provided above to get it to work with Maximo/Jython 2.5.2 and doesn't require downloading and adding new modules or packages and all that this entails with Maximo. Bypassing or temporarily disabling ssl is fine as the code checks the hash of the downloaded .egg file. This would be my preferred solution if possible.
In my experience, automation scripting works best if you can stay "as Java as possible" and "as Maximo as possible". So, I would use the LIB_HTTPCLIENT script from the Scripting 76 Features document (the first example code, whose name is given by inference in the second bit of code) to try to download the SetupTools.
In case that document moves again, here is the LIB_HTTPCLIENT script. Note that the url variable is expected to be passed to this library script by the calling script.
from psdi.iface.router import HTTPHandler
from java.util import HashMap
from java.util import String
handler = HTTPHandler()
map = HashMap()
map.put("URL",url)
map.put("HTTPMETHOD","GET")
responseBytes = handler.invoke(map,None)
response = String(responseBytes,"utf-8")

Tracker GV500 - Device management

I currently registered my Quecklink GV500 to cumulocity and I'm able to receive some events and measurements.
But when I try to send command to my Quecklink GV500 registered in Cumulocity but I always hava a FAILED response. For example, I tried to send this command (which is fully supported by the GV500) from SHELL tab: AT+GTTMA=gv500,+,1,0,0,,,,,,FFFF$
And as result I got:
Failure reason: Command currently not supported
I also tried to get the agent logs by using "Log file request" in the "Log" tab of my Device and as result I got:
Failure reason: Cannot build command. Search parameters only allow the
following characters [a-zA-Z0-9_]
Is it normal?
When I look the general information in "Info" tab I have:
Send connection: online
Push connection: inactive
Is it normal that Push connection is marked as inactive?
The tracker-agent in it current state does not use a push connection for receiving operations but does a polling of the operations. Therefore the push connection is always shown as inactive.
If you receive "Failure reason: Command currently not supported" it is an error from the agent not the device. The agent seems not to support shell operations for Queclink.
As for the error on the log file request it seems that there was an unsupported character in the search parameter. Maybe you can share what you entered for the parameters in the UI
Thanks for your answer. For the log file request I let blank value in the search input field. If I try to enter "gl200", I get the following error: Command currently not supported.
So to resume can you confirm that Quecklink devices can't be managed from Cumulocity for the moment? It's supported for which device?

Restcomm Media Player fail to paly file on S3 with error 312

I have a file on AWS S3 that is public:
https://s3-eu-west-1.amazonaws.com/voxist-greetings/33631222504/33651291239_95113eed-386b-4264-a4cf-46182faae125COUCOU1.wav
Now when RVD try to play it I get:
INFO [org.mobicents.servlet.restcomm.interpreter.VoiceInterpreter] (RestComm-akka.actor.default-dispatcher-8586) MediaGroupResponse, succeeded: false jain.protocol.ip.mgcp.JainIPMgcpException: The IVR request failed with the following error code 312
I don't know why... The same file used to work with another name.
Thanks for any hint on how to debug this.
The problem seems to happen on Media Server side. More specifically, it seems the file cannot be opened for some reason.
Relevant code line can be found here.
Can you please take a tcpdump and share it, so we can see the MGCP Play request?
Hope this helps.
UPDATE:
Here is an example:
The 200 OK simply indicates that the MGCP transaction completed successfully. Now we need to dissect the notification (NTFY) sent from Media Server to RestComm, mainly the ObservedEvents parameter.
If you look at the picture, you will see the event triggered is an OperationFailed (of) with ReturnCode (rc) equal to 312, which is an error.
Relevant link to specs can be found here.
To summarise, Media Server receives the request to play the file (in this case a cached version of it) but if fails to open the URL for some reason.
Is the URL reachable from Media Server side?

pyusb assertion error - no usb out endpoint?

I'm trying to program (upload new messages to) a scrolling LED badge via python on Linux instead of via the windows exe. I've got a capture of a successful upload via the windows app that I'll use as a template, but at the moment I'm having trouble writing anything at all to the device.
When I run my script, I get an assertion error, which I assume means that no OUT endpoints have been found. lsusb seems to corroborate this, but I could be mistaken. This is basically straight from the pyusb tutorial with alternate_setting removed from intf because it was causing a pipe error and is apparently not necessary.
intf = usb.util.find_descriptor(cfg, bInterfaceNumber = interface_number,)
ep = usb.util.find_descriptor(
intf,
# match the first OUT endpoint
custom_match = \
lambda e: \
usb.util.endpoint_direction(e.bEndpointAddress) == \
usb.util.ENDPOINT_OUT
)
assert ep is not None # < assertion error
In case it helps, lsusb -vv for the LED badge: http://bpaste.net/show/biixy6e38A71WlCw7euU/
Any guidance would be much appreciated - I'm entirely new to USB protocol, and not great at python either.