OSError: No Default Input Device Available (PyAudio) - python

I am using this Github repo to guide me in my process to create a Flask application that can detect your mood via your voice. To build the application I was on Windows 10 using Pycharm and Python 3.6. Everything works fine and I have no issues as you can see with this output: successful output.
My problems arise when I clone my app to my Ubuntu subsystem on my Windows machine or my Google VM running Ubuntu 18. When I try to record my voice I get this error: OSError: [Errno -9996] Invalid output device (no default output device) (full error here).
I have seen this Stackoverflow post get linked many times when encountering this error but none of the answers fixed my issue.
When I run this code
>>> import pyaudio
>>> pa = pyaudio.PyAudio()
>>> pa.get_default_input_device_info()
I get this ouput
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/ian/app/env/lib/python3.6/site-packages/pyaudio.py", line 949, in get_default_input_device_info
device_index = pa.get_default_input_device()
OSError: No Default Input Device Available

Related

osquery-python extension causing osqueryi errors

I have a newbie question about creating osquery extensions using osquery-python. I Created a small extension that gets some additional RPM info from my linux system. Following the instructions in the docs, I added the path to the extension in /etc/osquery/extensions.load to get it to autoload. I restarted osqueryd and I see the extension running using ps ax.
If I interactively run osqueryi, I can see the table and get data. It all works perfectly.
However, when I run an osqueryi command 'one-liner' such as :
osqueryi .tables
I get a bunch of the following errors with my output:
#INFO:thrift.transport.TSocket:Could not connect to /root/.osquery/shell.em
Traceback (most recent call last):
File "build/bdist.linux-x86_64/egg/thrift/transport/TSocket.py", line 104, in open
handle.connect(sockaddr)
File "/usr/lib64/python2.7/socket.py", line 224, in meth
return getattr(self._sock,name)(*args)
error: [Errno 2] No such file or directory
ERROR:thrift.transport.TSocket:Could not connect to any of ['/root/.osquery/shell.em']
What have I done wrong?
Extensions are run in a separate process. You can see the socket errors, which indicate the extension process cannot communicate with osquery process. Make sure osqueryd or osqueryi is running. Link: osquery doc page for extensions.

Chirp Running on Maemo

I'm trying to get Chirp to run under Maemo5 (a debian based mobile operating system).
When running .chirpw or setup.py I get this as a result
Nokia-N900:~/compile/chirp-0.3.1# ./chirpw
CHIRP 0.3.1 on Linux - Maemo 5 %h (Python 2.5.4)
Traceback (most recent call last):
File "./chirpw", line 105, in <module>
from chirp import *
File "/root/compile/chirp-0.3.1/chirp/icq7.py", line 50
class ICQ7Radio(icf.IcomCloneModeRadio):
^
SyntaxError: invalid syntax
I am using the chirp source found here: http://chirp.danplanet.com/download/0.3.1/chirp-0.3.1.tar.gz
The idea is to be able to program my radios from my linux powered phone, however I can't seem to figure out why the program is getting held up on the ICQ7Radio class.
Any help/pointers would be much appreciated.
That version is quite old, have a try with latest daily build http://trac.chirp.danplanet.com/chirp_daily/LATEST/
You can also download full hg repository with
hg clone http://d-rats.com/hg/chirp.hg
See also http://chirp.danplanet.com/projects/chirp/wiki/Developers

JPype won't compile properly

So I am having trouble compiling a very simple python script using JPype.
My code goes like:
from jpype import *
startJVM(getDefaultJVMPath(), "-ea")
java.lang.System.out.println("hello world")
shutdownJVM()
and when I run it I receive an error saying:
Traceback (most recent call last): File "test.py", line 2, in
<module>
startJVM(getDefaultJVMPath(), "-ea") File "/usr/lib/pymodules/python2.7/jpype/_core.py", line 44, in startJVM
_jpype.startup(jvm, tuple(args), True) RuntimeError: Unable to load DLL [/usr/java/jre1.5.0_05/lib/i386/client/libjvm.so], error =
/usr/java/jre1.5.0_05/lib/i386/client/libjvm.so: cannot open shared
object file: No such file or directory at
src/native/common/include/jp_platform_linux.h:45
I'm stuck and I really need help. Thanks!
I had the same problem
RuntimeError: Unable to load DLL [/usr/java/jre1.5.0_05/lib/i386/client/libjvm.so], error = /usr/java/jre1.5.0_05/lib/i386/client/libjvm.so: cannot open shared object file: No such file or directory at src/native/common/include/jp_platform_linux.h:45
In my case wrong JAVA_HOME path was set
/profile/etc
export JAVA_HOME
JAVA_HOME=/usr/lib/jvm/java-6-openjdk-amd64
PATH="$JAVA_HOME/bin:$PATH"
export PATH
The work around is to define the full path directly in the call to the JVM:
from jpype import *
startJVM('/Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/MacOS/libjli.dylib', "-ea", "-Djava.class.path=/tmp/Jpype/sample")
java.lang.System.out.println("Hello World!!")
shutdownJVM()
Original text:
Similar issues when trying to run JPype on MacOS El Capitan. I could
not figure out how to coax the _darwin.py code finding the correct JVM
location, despite the JAVA_HOME system variable being set properly.
Caveat cursor, trying to run the above code in the Spyder IPython console did not produce any output, but the normal Console would.

Python on different computers report failed assertion differently

On the remote server I run my code on Python does neither output the exact line of a failed assertion nor the following comment. On my local machine the output is as expected.
What is the reason for that? Do I need to install additional packages?
Remote server:
...
Traceback (most recent call last):
File "classify.py", line 48, in <module>
print "start reading files"
AssertionError
me#remoe:~/foo$ python --version
Python 2.7.2+
On my local machine:
...
start processing training data
Traceback (most recent call last):
File "classify.py", line 83, in <module>
assert(test_images == 0) # no test files found
AssertionError
me#local:~/foo$ python --version
Python 2.6.6
[Update]
The code on the server is the same as on the local machine as I mount my local hdd on my server.
I tried writing a minimal example, but it was to minimal, so that there was no effect. I will try to build an more extensive minimal example where the bug occurs.
Can somebody point me to a tutorial to install another python version w/o messing everything up.

nxt-py no backends error

i am trying to run one of the example scripts for nxt py library using pyusb. whenever i try to run the examples i get the following error:
USB module unavailable, not searching there
Bluetooth module unavailable, not searching there
Traceback (most recent call last):
File "C:\Documents and Settings\*\Desktop\nxt-python-2.2.1\examples\mary.py", line
15, in <module>
b = nxt.locator.find_one_brick()
File "C:\Python27\lib\site-packages\nxt\locator.py", line 112, in find_one_brick
for s in find_bricks(host, name, silent, method):
File "C:\Python27\lib\site-packages\nxt\locator.py", line 80, in find_bricks
raise NoBackendError("No selected backends are available! Did you install the comm
modules?")
NoBackendError: No selected backends are available! Did you install the comm modules?
i have no idea how to fix this and i was wondering if there was any other way than just switching to bluetooth?
USB and Bluetooth are unavailable. You need to install python modules to be able to run examples.
Here is installation guide,
choose your operating system.
For me (mac os x) works only fantomusb. Also I needed to set attributes for brick locator to find it trought fantomusb.
b = nxt.locator.find_one_brick(name="NXT", strict=True, method=nxt.locator.Method(bluetooth=False, fantomusb=True, fantombt=False, usb=False))

Categories

Resources