Houndify: sample_wave.py error: "unsupported operand type(s) for %: 'bytes' and 'int'" - houndify

Downloaded Houndify Python and C++ to try each.
+ Got the C++ sample to compile and run well.
+ sample_text.py runs fine.
sample_wave.py and sample_stdin.py both fail with the same error:
$ ./sample_wave.py '...my client ID here...' '...my client key here...' test_audio/whattimeisitindenver.wav
============== test_audio/whattimeisitindenver.wav ===================
Traceback (most recent call last):
File "./sample_wave.py", line 72, in <module>
client.start(MyListener())
File "/home/system/catkin_ws/src/houndify/houndify_python3_sdk_0.3.0/houndify.py", line 179, in start
self._send(audio_header)
File "/home/system/catkin_ws/src/houndify/houndify_python3_sdk_0.3.0/houndify.py", line 288, in _send
self.conn.send(b'%x\r\n' % len(msg))
TypeError: unsupported operand type(s) for %: 'bytes' and 'int'

It looks like this is a bug in the Python SDK, but it has been fixed in the latest version which is 0.3.1 (https://docs.houndify.com/sdks#python).

Related

Pyusb and Libusb giving NoBackendError on MacOS

I'm on MacOS Big Sur trying to run rfcat. I am running anaconda as well and I have set up an environment with Python2.7 when I originally got errors with Python3.x. I have downloaded the pyusb, pyreadline, ipython, PySide2, and the libusb dependancies. Libusb seems to be giving me the most trouble. I keep getting the following error:
Error in resetup():NoBackendError('No backend available',)
Error in resetup():NoBackendError('No backend available',)
Error in resetup():NoBackendError('No backend available',)
^CTraceback (most recent call last):
File "/opt/anaconda3/envs/rftools/bin/rfcat", line 4, in <module>
__import__('pkg_resources').run_script('rfcat==1.9.5', 'rfcat')
File "/opt/anaconda3/envs/rftools/lib/python2.7/site-packages/pkg_resources/__init__.py", line 666, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/opt/anaconda3/envs/rftools/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1469, in run_script
exec(script_code, namespace, namespace)
File "/opt/anaconda3/envs/rftools/lib/python2.7/site-packages/rfcat-1.9.5-py2.7.egg/EGG-INFO/scripts/rfcat", line 63, in <module>
File "build/bdist.macosx-10.7-x86_64/egg/rflib/__init__.py", line 208, in interactive
File "build/bdist.macosx-10.7-x86_64/egg/rflib/chipcon_nic.py", line 103, in __init__
File "build/bdist.macosx-10.7-x86_64/egg/rflib/chipcon_usb.py", line 93, in __init__
File "build/bdist.macosx-10.7-x86_64/egg/rflib/chipcon_usb.py", line 238, in resetup
KeyboardInterrupt
From my research so far, backend is how pyusb refers to libusb, libusb1 or openusb. It is unable to find the libusb within the environment. I did a little tracking and found that ultimately, the find_library() function is found in ctypes in util.py. It refers to the executable path for MacOS with #executable_path/../lib/libusb%s..... I tried to put libusb into a folder on my executable path to hopefully match this functions search, and still got the same errors. I then found instructions on inputting a custom path for the backend for pyusb here. This appears to be a method where you input the device and backend information at the beginning of your program. The code I inserted is as follows:
import usb.core
import usb.backend.libusb1 as libusb1
backend = libusb1.get_backend(find_library=lambda x: "/path/to/file/lib/libusb-1.0.0.dylib")
dev = usb.core.find(idVendor=“MyVID”, idProduct=“MyPID”, backend=backend)
This induced a similar error but with a different traceback when I placed the code in rflib.init and the rfcat codes:
Traceback (most recent call last):
File "/opt/anaconda3/envs/rftools/bin/rfcat", line 4, in <module>
__import__('pkg_resources').run_script('rfcat==1.9.5', 'rfcat')
File "/opt/anaconda3/envs/rftools/lib/python2.7/site-packages/pkg_resources/__init__.py", line 666, in run_script
self.require(requires)[0].run_script(script_name, ns)
File "/opt/anaconda3/envs/rftools/lib/python2.7/site-packages/pkg_resources/__init__.py", line 1469, in run_script
exec(script_code, namespace, namespace)
File "/opt/anaconda3/envs/rftools/lib/python2.7/site-packages/rfcat-1.9.5-py2.7.egg/EGG-INFO/scripts/rfcat", line 12, in <module>
File "build/bdist.macosx-10.7-x86_64/egg/rflib/__init__.py", line 15, in <module>
File "/opt/anaconda3/envs/rftools/lib/python2.7/site-packages/usb/core.py", line 1304, in find
raise NoBackendError('No backend available')
usb.core.NoBackendError: No backend available
I have since reset things back to how I started and am still getting the original error listed above.
I think this largely has to do with the anaconda environment, which I can of course remove. I want to try to find a way to make this work though. Is there a better method to help rfcat find the libusb as required? Another possible solution is resolving the actual executable_path. Does anyone know how to find the executable_path?
In case it helps, I will list the default locations for commands and files.
rfcat: /opt/anaconda3/envs/rftools/lib/python2.7/site-packages/rfcat
pyusb: /opt/anaconda3/envs/rftools/lib/python2.7/site-packages/usb
ctypes: /opt/anaconda3/envs/rftools/lib/python2.7/ctypes
libusb: /opt/anaconda3/envs/rftools/lib/python2.7/site-packages/usb/lib

Blender 2.82 hardops

Geeting an error while using mirror in hardops. I am using mac and it is working fine in windows. can it not be used in Mac?
Traceback (most recent call last):
File "///Library/Application Support/Blender/2.82/scripts/addons/HOps/operators/Gizmos/mirror.py", line 347, in invoke
current_tool = ToolSelectPanelHelper._tool_get_active(context, 'VIEW_3D', None)[0][0]
File "/Applications/Blender.app/Contents/Resources/2.82/scripts/startup/bl_ui/space_toolsystem_common.py", line 250, in _tool_get_active
for item in ToolSelectPanelHelper._tools_flatten(cls.tools_from_context(context, mode)):
AttributeError: type object 'ToolSelectPanelHelper' has no attribute 'tools_from_context'
location: :-1
Maybe it can help: I had this error on windows with previous currium Hard Ops, which is solved with latest Hard Ops update : Neodymium
Link to Hard Ops on BlenderMarket

Not able to run basic example of pycparser

I am trying to start with pycparser and was trying to run the examples given on the github repo. I only changed the path of the file to be parsed after saving the sample c file locally. I get the following error and am not sure if there is some pre-processing step that I am missing?
File "D:\Anaconda3\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 714, in runfile
execfile(filename, namespace)
File "D:\Anaconda3\lib\site-packages\spyderlib\widgets\externalshell\sitecustomize.py", line 89, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)
File "C:/Users/Z003RTRP/Desktop/cparse.py", line 20, in <module>
ast = parse_file(filename, use_cpp=True, cpp_path='gcc', cpp_args=r'-Iutils/fake_libc_include')
File "D:\Anaconda3\lib\site-packages\pycparser\__init__.py", line 86, in parse_file
text = preprocess_file(filename, cpp_path, cpp_args)
File "D:\Anaconda3\lib\site-packages\pycparser\__init__.py", line 49, in preprocess_file
('Original error: %s' % e))
RuntimeError: Unable to invoke 'cpp'. Make sure its path was passed correctly
Original error: [WinError 2] The system cannot find the file specified
Take a look at this section of the README - you have to point cpp_path to the C preprocessor on your system. For Windows, it recommends downloading a binary build of Clang and using clang -E

Error with gclient sync while getting the chromium code on Mac OS

I'm trying to setup the chromium code following the documentation on Mac OS X 10.9.2.
I could successfully fetch the code with command:
fetch --nohooks chromium --nosvn=True
but when I try to sync the projects with gclient sync command it's breaking in the middle of the process throwing the following OSError:
________ running '/usr/bin/python src/build/download_nacl_toolchains.py --no-arm-trusted --keep' in '/Volumes/NJHD/google'
Updating /Volumes/NJHD/google/src/native_client/toolchain/.tars/toolchain_mac_x86.tar.bz2
from https://storage.googleapis.com/nativeclient-archive2/x86_toolchain/r12790/toolchain_mac_x86.tar.bz2.
.....................................................................................
|------------------------------------------------|
..................................................Traceback (most recent call last):
File "src/build/download_nacl_toolchains.py", line 63, in <module>
sys.exit(Main(sys.argv[1:]))
File "src/build/download_nacl_toolchains.py", line 58, in Main
download_toolchains.main(args)
File "/Volumes/NJHD/google/src/native_client/build/download_toolchains.py", line 414, in main
keep=options.keep, verbose=options.verbose):
File "/Volumes/NJHD/google/src/native_client/build/download_toolchains.py", line 263, in SyncFlavor
tar.Extract()
File "/Volumes/NJHD/google/src/native_client/build/cygtar.py", line 313, in Extract
self.tar.extract(m)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/tarfile.py", line 2084, in extract
self._extract_member(tarinfo, os.path.join(path, tarinfo.name))
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/tarfile.py", line 2168, in _extract_member
self.makelink(tarinfo, targetpath)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/tarfile.py", line 2252, in makelink
os.link(tarinfo._link_target, targetpath)
OSError: [Errno 45] Operation not supported
Error: Command /usr/bin/python src/build/download_nacl_toolchains.py --no-arm-trusted --keep returned non-zero exit status 1 in /Volumes/NJHD/google
Hook '/usr/bin/python src/build/download_nacl_toolchains.py --no-arm-trusted --keep' took 89.91 secs
It seems to me that it is complaining about os.link(tarinfo._link_target, target path), so I tried creating a link using that function which works fine.
Is there any other configuration that I need to take care of?
Thanks in advance!
I placed the chromium project on an external hard disk as you did, and I got the same error.
Perhaps you should try the syncing stuff in your internal drive.
Haven't tried. Hope that help.

Django-Haystack elasticsearch error in index_queryset

when trying to build indexes for elasticsearch on django-haystack, i get the error (full traceback below)
TypeError: index_queryset() got an unexpected keyword argument 'using'
It is on Python 2.6, Django 1.4, ElasticSearch 0.20.2. Previously i have encountered a similar prefetch error, which was the case of version mismatch between pyelasticsearch and requests library. i've tried to downgrade requests to 0.13, but no effect. pyelasticsearch is currently 0.3
any help very much appreciated!
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/var/www/myproj/myproj-env/lib/python2.6/site-packages/django/core/management/__init__.py", line 443, in execute_from_command_line
utility.execute()
File "/var/www/myproj/myproj-env/lib/python2.6/site-packages/django/core/management/__init__.py", line 382, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/var/www/myproj/myproj-env/lib/python2.6/site-packages/django/core/management/base.py", line 196, in run_from_argv
self.execute(*args, **options.__dict__)
File "/var/www/myproj/myproj-env/lib/python2.6/site-packages/django/core/management/base.py", line 232, in execute
output = self.handle(*args, **options)
File "/var/www/myproj/myproj-env/src/django-haystack/haystack/management/commands/update_index.py", line 184, in handle
return super(Command, self).handle(*items, **options)
File "/var/www/myproj/myproj-env/lib/python2.6/site-packages/django/core/management/base.py", line 341, in handle
label_output = self.handle_label(label, **options)
File "/var/www/myproj/myproj-env/src/django-haystack/haystack/management/commands/update_index.py", line 210, in handle_label
self.update_backend(label, using)
File "/var/www/myproj/myproj-env/src/django-haystack/haystack/management/commands/update_index.py", line 239, in update_backend
end_date=self.end_date)
File "/var/www/myproj/myproj-env/src/django-haystack/haystack/indexes.py", line 157, in build_queryset
index_qs = self.index_queryset(using=using)
TypeError: index_queryset() got an unexpected keyword argument 'using'
The problem is in the version of django-haystack. The current version is 0.3, while few months ago it was 1.0, which is a bit of misunderstanding.
My way to solve the problem is simple and straightforward - install the latest version (0.3), then get the older version (in this case - 1.0) and simply overwrite haystack sources.
the conclusion: "older 1.0" works smooth with the latest versions of all prerequisites (pyelasticsearch, simplejson and requests), while "newer 0.3" doesn't

Resources