Speech recognition library is giving error of input device - python-3.x

I am doing voice recognition using python library "Speech Recognition",Every thing is going well with audio files but when i use mike, it is showing this error.
Traceback (most recent call last):
File "StoTUsingMike.py", line 5, in <module>
with sr.Microphone() as source:
File "/home/nash/.local/lib/python3.5/site-packages/speech_recognition/__init__.py", line 86, in __init__
device_info = audio.get_device_info_by_index(device_index) if device_index is not None else audio.get_default_input_device_info()
File "/usr/local/lib/python3.5/dist-packages/pyaudio.py", line 949, in get_default_input_device_info
device_index = pa.get_default_input_device()
OSError: No Default Input Device Available
I have seen 2 or 3 more posts regarding this error on stack overflow but there is no clear solution.
Kindly help me out of this problem.

Related

Python3 ArcPy path/permissions setting error sd Hosted Services

Traceback (most recent call last):
File "<string>", line 34, in <module>
File "C:\Program Files\ArcGIS\Pro\Resources\ArcPy\arcpy\mp.py", line 105, in CreateWebLayerSDDraft
return _convertArcObjectToPythonObject(arcgisscripting._mapping.CreateWebLayerSDDraft(*_gp_fixargs([map_or_layers, out_sddraft, service_name, server_type, service_type, folder_name, overwrite_existing_service, copy_data_to_server, enable_editing, allow_exporting, enable_sync, summary, tags, description, credits, use_limitations], True)))
ValueError: Staging path is invalid or inaccessible: C:\Users\hagerty_finn\Documents\ArcGIS\Projects\TrafficFatalityCount\temp.txt
Line 34:
arcpy.mp.CreateWebLayerSDDraft(mp, sddraft, sd_fs_name, 'MY_HOSTED_SERVICES', 'FEATURE_ACCESS')
I tried changing the file path to another user and updating the password. The problem persists. I am running this script in ArcGIS Pro Python window on a GIS local server.

What can I do against a Key Error ' Csrftoken'?

I'm a complete beginner. I wanted to download something from github on Termux and everything went fine until the last step when the key error 'csrftoken' appeared. I would really appreciate if someone could help me out. That's the error:
Traceback (most recent call last):
File "/data/data/com.termux/files/home/alkrinsta/alkrinsta.py", line 146, in <module>
sess = instabrute.Login(password)
File "/data/data/com.termux/files/home/alkrinsta/alkrinsta.py", line 106, in Login
sess.headers.update({'X-CSRFToken' : r.cookies.get_dict()['csrftoken']})
KeyError: 'csrftoken'

ERROR: dP15zlyra3c: YouTube said: Unable to extract video data

I found the code below at Youtube download using Youtube-dl embedded with Python - 2020
After I ran pip3 list I saw youtube-dl 2020.3.24 in the list.
However, when I run...
# ydl1.py
from __future__ import unicode_literals
import youtube_dl
ydl_opts = {}
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
ydl.download(['https://www.youtube.com/watch?v=dP15zlyra3c'])
I see the following error...
[youtube] dP15zlyra3c: Downloading webpage
ERROR: dP15zlyra3c: YouTube said: Unable to extract video data
Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/youtube_dl/YoutubeDL.py", line 797, in extract_info
ie_result = ie.extract(url)
File "/usr/lib/python3/dist-packages/youtube_dl/extractor/common.py", line 530, in extract
ie_result = self._real_extract(url)
File "/usr/lib/python3/dist-packages/youtube_dl/extractor/youtube.py", line 1788, in _real_extract
raise ExtractorError(
youtube_dl.utils.ExtractorError: dP15zlyra3c: YouTube said: Unable to extract video data
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "ydl1.py", line 7, in <module>
ydl.download(['https://www.youtube.com/watch?v=dP15zlyra3c'])
File "/usr/lib/python3/dist-packages/youtube_dl/YoutubeDL.py", line 2018, in download
res = self.extract_info(
File "/usr/lib/python3/dist-packages/youtube_dl/YoutubeDL.py", line 820, in extract_info
self.report_error(compat_str(e), e.format_traceback())
File "/usr/lib/python3/dist-packages/youtube_dl/YoutubeDL.py", line 625, in report_error
self.trouble(error_message, tb)
File "/usr/lib/python3/dist-packages/youtube_dl/YoutubeDL.py", line 595, in trouble
raise DownloadError(message, exc_info)
youtube_dl.utils.DownloadError: ERROR: dP15zlyra3c: YouTube said: Unable to extract video data
y#y-peppy:~/.config/autokey$
What am I doing wrong?
Updating youtube-dl. Depending on the way you installed it, here are the commands:(in windows)
1-youtube-dl --update (self-update)
2-pip install -U youtube-dl (via python)
3-choco upgrade youtube-dl (Windows + Chocolatey)
and a cookies.txt file can be created with the "cookies.txt" extension.
Do this while being logged in to YouTube.
for example :
For Firefox:
this
For Chrome:this
Then run youtube-dl like this:
youtube-dl.exe --cookies C:\Users\tezJR\Downloads\cookies-txt https://www.youtube.com/watch?v=$VIDEO-ID
adjust that command to where your cookies.txt file is actually located and replace $VIDEO-ID with the ID of your restricted video

ValueError: unsupported pickle protocol: 5 eventhough I have installed pickle5

I am running a python 3.7 conda environment and I have imported pickle5 into my code however I am still getting the following error regardless:
C:\Users\Joel\Desktop\Bowls App Object Detection>python obj.py
Using TensorFlow backend.
Generating anchor boxes for training images and annotation...
Traceback (most recent call last):
File "obj.py", line 7, in
trainer.setTrainConfig(object_names_array=["white bowls, black bowls, yellow bowls"], batch_size=4, num_experiments=100, train_from_pretrained_model="pretrained-yolov3.h5")
File "C:\Users\Joel\anaconda3\envs\py37\lib\site-packages\imageai\Detection\Custom_init_.py", line 171, in setTrainConfig
self.__train_cache_file, self.__model_labels)
File "C:\Users\Joel\anaconda3\envs\py37\lib\site-packages\imageai\Detection\Custom\gen_anchors.py", line 82, in generateAnchors
model_labels
File "C:\Users\Joel\anaconda3\envs\py37\lib\site-packages\imageai\Detection\Custom\voc.py", line 9, in parse_voc_annotation
cache = pickle.load(handle)
ValueError: unsupported pickle protocol: 5
It would be great if someone could help out!

Phone Book Access (PBAP) client for Linux (Raspberry Pi)

i want to access the contacts of my smartphone over bluetooth. This should be made as first step of a project of my with a raspberry pi. I read something about the phone bok access protocol (PBAP).
But all i could was not very helpful for me. The most examples i found where to old.
I already managed to pair and connect my smart phone (OnePlus One). I also can see that is support PBAP. I use bluez in version 5.23-2+rpi1.
I found two examples of an PBAP client, one from obexd (http://code.metager.de/source/xref/linux/bluetooth/obexd/test/pbap-client) and one from bluez (http://code.metager.de/source/xref/linux/bluetooth/bluez/test/pbap-client).
If i execute the obexd example on the pi i get the following error:
Creating Session
Traceback (most recent call last):
File "pbap-client-obexd.py", line 110, in <module>
session_path = client.CreateSession(sys.argv[1], { "Target": "PBAP" })
File "/usr/lib/python2.7/dist-packages/dbus/proxies.py", line 70, in __call__
return self._proxy_method(*args, **keywords)
File "/usr/lib/python2.7/dist-packages/dbus/proxies.py", line 145, in __call__
**keywords)
File "/usr/lib/python2.7/dist-packages/dbus/connection.py", line 651, in call_blocking
message, timeout)
dbus.exceptions.DBusException: org.bluez.obex.Error.Failed: No adapter found
If i execute the bluez example i get the following error:
Creating Session
Traceback (most recent call last):
File "pbap-client-bluez.py", line 128, in <module>
session_path = client.CreateSession(sys.argv[1], { "Target": "PBAP" })
File "/usr/lib/python2.7/dist-packages/dbus/proxies.py", line 70, in __call__
return self._proxy_method(*args, **keywords)
File "/usr/lib/python2.7/dist-packages/dbus/proxies.py", line 145, in __call__
**keywords)
File "/usr/lib/python2.7/dist-packages/dbus/connection.py", line 651, in call_blocking
message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.UnknownObject: Method "CreateSession" with signature "sa{ss}" on interface "org.bluez.obex.Client1" doesn't exist
Does anyone of you have an idea to fix it, an actual tutorial or an other example?
Thank you
After searching a few hours later, i found a python library called PyOBEX. It contains some examples, e.g. a PBAP-Client, a example to download files over bluetooth and much more. It also contains all methods for pairing and connecting. Works on first try for me.
Link:
https://bitbucket.org/dboddie/pyobex/overview
PyOBEX is the right choice. you can also have a look into pypbap which has both pbap client and server built on top of PyOBEX. And has nice REPL to playaround with all pbap functionalities.

Resources