Python SpeechRecognition error - python-2.7

I am exploring speech recognition and came across this python library called SpeechRecognition. I am running a linux mint system and have followed the troubleshooting steps on the webpage linked above. However, I get the following error:
Traceback (most recent call last):
File "test.py", line 4, in <module>
audio = r.listen(source) # listen for the first phrase and extract it into audio data
File "/usr/local/lib/python2.7/dist-packages/speech_recognition/__init__.py", line 268, in listen
buffer = source.stream.read(source.CHUNK)
File "/usr/lib/python2.7/dist-packages/pyaudio.py", line 605, in read
return pa.read_stream(self._stream, num_frames)
KeyboardInterrupt
Any help is greatly appreciated. I also do understand that the KeyboardInterrupt part of the error is from my doing, pressing ctrl+c.

Related

pytorch-yolov3 train RuntimeError: Unable to find a valid cuDNN algorithm to run convolution

https://github.com/ultralytics/yolov3/
When I started training yolov3 with 'python train.py' this happened, what is the reason?
Traceback (most recent call last):
File "train.py", line 415, in <module>
train() # train normally
File "train.py", line 279, in train
scaled_loss.backward()
File "C:\Users\zst\anaconda3\lib\site-packages\torch\tensor.py", line 198, in backward
torch.autograd.backward(self, gradient, retain_graph, create_graph)
File "C:\Users\zst\anaconda3\lib\site-packages\torch\autograd\__init__.py", line 100, in backward
allow_unreachable=True) # allow_unreachable flag
RuntimeError: Unable to find a valid cuDNN algorithm to run convolution (try_all at ..\aten\src\ATen\native\cudnn\Conv.cpp:693)
(no backtrace available)
win10 2080ti cuda10.2 cudnn7604 python 3.7 torch1.5 torchvision0.6
Trace screenshot:
Environment screenshot:

WindowsError: [Error 2] The system cannot find the file specified pytesseract

I'm trying to run this python code, but it keeps throwing the same error. I'm using pytesseract on a windows machine (coding in pycharm) to scan an image. I made a project on cloud9 that haevily used pytesseract in amazon web services and everything worked fine I am convinced that this is a windows problem. This is all in python 2.7 (this is a small test program I made to debug this same problem in a much bigger project)
Here's my code:
try:
import Image
except ImportError:
from PIL import Image
import pytesseract
filename = "Z:\Pycharm Projects\IBM-Waldon-master\screenshots\image.png"
print pytesseract.image_to_string(Image.open(filename))
I've tried making the meat of the code a function and restarting my computer but it still throws this error:
Z:\Python27\interpeter\Scripts\python.exe "Z:/Pycharm Projects/IBM-Waldon-
master/testest.py"
Traceback (most recent call last):
File "Z:/Pycharm Projects/IBM-Waldon-master/testest.py", line 9, in <module>
print pytesseract.image_to_string(Image.open(filename))
File "Z:\Python27\interpeter\lib\site-packages\pytesseract\pytesseract.py", line 193, in image_to_string
return run_and_get_output(image, 'txt', lang, config, nice)
File "Z:\Python27\interpeter\lib\site-packages\pytesseract\pytesseract.py", line 140, in run_and_get_output
run_tesseract(**kwargs)
File "Z:\Python27\interpeter\lib\site-packages\pytesseract\pytesseract.py", line 111, in run_tesseract
proc = subprocess.Popen(command, stderr=subprocess.PIPE)
File "Z:\Python27\Lib\subprocess.py", line 394, in __init__
errread, errwrite)
File "Z:\Python27\Lib\subprocess.py", line 644, in _execute_child
startupinfo)
WindowsError: [Error 2] The system cannot find the file specified
Process finished with exit code 1
On Windows, PIL uses whatever program is registered to open a temporary .BMP file. When the program returns, the temporary file is deleted.
By far the most common problem is that the program sends back a return code even before it even opens the file, and the file is deleted before it can be opened. Unfortunately the default viewer in Windows Vista and 7 has this problem; XP used the Microsoft Image and Fax viewer which was OK.
You can use File Explorer to change the program associated with .BMP files.

Error with XlWings on mac with parallels

I try to open the fibonacci template on my mac using Microsoft Excel from Parallels but I get the following error (xlwings version 0.4.1).
The file is well opened automatically with Microsoft Excel and the error comes.
Has someone any idea on how to correct that ?
In[39]: wb = Workbook(r'/Users/Downloads/fibonacci.zip Folder/fibonacci.xlsm')
Traceback (most recent call last):
File "/Users/anaconda/lib/python2.7/site- packages/IPython/core/interactiveshell.py", line 3035, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "<ipython-input-39-8750713fa323>", line 1, in <module>
wb = Workbook(r'/Users/Downloads/fibonacci.zip Folder/fibonacci.xlsm')
File "/Users/anaconda/lib/python2.7/site-packages/xlwings/main.py", line 158, in __init__
self.name = xlplatform.get_workbook_name(self.xl_workbook)
File "/Users/anaconda/lib/python2.7/site-packages/xlwings/_xlmac.py", line 102, in get_workbook_name
return xl_workbook.name.get()
File "/Users/anaconda/lib/python2.7/site-packages/aeosa/appscript/reference.py", line 498, in __call__
raise CommandError(self, (args, kargs), e, self.AS_appdata)
CommandError: Command failed:
OSERROR: -1708
MESSAGE: Application could not handle this command.
COMMAND: app(u'/Users/Applications (Parallels)/{716d2333-63ae-4f42-a203-ae81a0a171db} Applications.localized/Microsoft Excel.app').workbooks['fibonacci.xlsm'].name.get()
If you want to use the Windows version of Excel from Mac through Parallels, you need to drive things from a Windows based Python installation, too (e.g. from the Windows Command Prompt instead of Mac Terminal).
If instead you want to drive Mac Excel 2011 or 2016 and in case Parallels is giving you a hard time, specify the path of the Mac Excel installation through app_target, see the docs or this question.

osx - dyld: Library not loaded Reason: image not found - Python Google Speech Recognition API

When I try to use the Google Speech Rec API I get this error message. Any help?
dyld: Library not loaded: /usr/local/Cellar/flac/1.3.1/lib/libFLAC.8.dylib
Referenced from: /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/speech_recognition/flac-mac
Reason: image not found
I'm using PyCharm.
I have tried copy pasting and uninstalling and reinstalling but to no avail. HELP :) My whole project is to get the user to say something, and have google translate translate it and have it say the answer. I have the translating and speaking covered, but the Speech Recognition is what I am having trouble with now. Thanks in advance
Here's more error messages.
Traceback (most recent call last):
File >"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line >162, in _run_module_as_main
"main", fname, loader, pkg_name)
File >"/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", >line >72, in _run_code
exec code in run_globals
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site->packages/speech_recognition/main.py", line 12, in
audio = r.listen(source)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site->packages/speech_recognition/init.py", line 264, in listen
buffer = source.stream.read(source.CHUNK)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site->packages/pyaudio.py", line 605, in read
return pa.read_stream(self._stream, num_frames)
IOError: [Errno Input overflowed] -9981
First, you must have homebrew installed.
Second, after homebrew is installed, you'll want to install flac:
brew install flac
Figured it out - I just forgot to install Homebrew

Bottle micro framework suddenly crash

i have web app that i have developed using bottle micro framework.
However it crash a lot and all of them suddenly without any action ( without using the web app) . So i have reviewed the logs file and find the following errors (i have no idea what the causation of these errors):
Traceback (most recent call last):
File "/home/hamoud/lib/python2.7/bottle.py", line 2699, in run
server.run(app)
File "/home/hamoud/lib/python2.7/bottle.py", line 2385, in run
srv = make_server(self.host, self.port, handler, **self.options)
File "/usr/local/lib/python2.7/wsgiref/simple_server.py", line 144, in make_server
server = server_class((host, port), handler_class)
File "/usr/local/lib/python2.7/SocketServer.py", line 419, in __init__
self.server_bind()
File "/usr/local/lib/python2.7/wsgiref/simple_server.py", line 48, in server_bind
HTTPServer.server_bind(self)
File "/usr/local/lib/python2.7/BaseHTTPServer.py", line 108, in server_bind
SocketServer.TCPServer.server_bind(self)
File "/usr/local/lib/python2.7/SocketServer.py", line 430, in server_bind
self.socket.bind(self.server_address)
File "/usr/local/lib/python2.7/socket.py", line 224, in meth
return getattr(self._sock,name)(*args)
TypeError: 'int' object is not callable
and
Traceback (most recent call last):
File "interface.py", line 29, in <module>
run(host="localhost", port=32471, reloader=True, debug=True)
File "/home/hamoud/lib/python2.7/bottle.py", line 2657, in run
os.utime(lockfile, None) # I am alive!
OSError: [Errno 2] No such file or directory: '/tmp/bottle.gQmJc8.lock'
However the second error doesn't crash the application ( application would continue working ) but for the first one it's require manual work ( run the app again ).
i could schedule task using cron job to run the application when it's crash. but i'd like to know what's the problem in my app.
A few ideas come to mind:
Could there be another program on your machine (e.g., a cron job) that is deleting files from /tmp?
Are you using the latest version of Bottle? (From the line number in your stacktrace, it looks like you might not be.)
If nothing else works, try running without reloader=True (or use reloader=False). I looked at the Bottle code, and that change should at least work around the problem, even though we don't know the cause (yet).
Hope that helps.