Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: __init__() got an unexpected keyword argument 'model_str' #18

Closed
tiny-tinker opened this issue Jun 9, 2016 · 5 comments
Closed

Comments

@tiny-tinker
Copy link

After successfully building from source, I'm running the demo, but ran into this error:

pi@raspberrypi:~/Downloads/snowboy/examples/Python $ python demo.py ./resources/snowboy.umdl 
Traceback (most recent call last):
  File "demo.py", line 27, in <module>
    detector = snowboydecoder.HotwordDetector(model, sensitivity=0.5)
  File "/home/pi/Downloads/snowboy/examples/Python/snowboydecoder.py", line 91, in __init__
    resource_filename=resource, model_str=model_str)
TypeError: __init__() got an unexpected keyword argument 'model_str'

Lines 90s in snowboydecoder.py:

        self.detector = snowboydetect.SnowboyDetect(
            resource_filename=resource, model_str=model_str)        # 91
        self.detector.SetAudioGain(audio_gain)
        self.num_hotwords = self.detector.NumHotwords()

But looking at snowboydetect.py, the constructor takes a pointer, so I'm not sure what it is complaining about. My python skills aren't great.

class SnowboyDetect(_object):
    __swig_setmethods__ = {}
    __setattr__ = lambda self, name, value: _swig_setattr(self, SnowboyDetect, name, value)
    __swig_getmethods__ = {}
    __getattr__ = lambda self, name: _swig_getattr(self, SnowboyDetect, name)
    __repr__ = _swig_repr
    def __init__(self, *args): 
        this = _snowboydetect.new_SnowboyDetect(*args)
        try: self.this.append(this)
        except: self.this = this
@chenguoguo
Copy link
Collaborator

Could you try the swig installation commands I pasted here? I suspect it's an issue with swig.

@chenguoguo
Copy link
Collaborator

Closing this since the issue was resolved through #17

@richardfuchs
Copy link

I also had the Error:
TypeError: init() got an unexpected keyword argument 'model_str'

My Setup:

  • Hardware: Raspberry Model B - Generation 1
  • OS: Raspbian Jessie

I fixed it running a modified version of the #17 (comment) scipt:

#!/bin/bash

# SWIG is a tool to compile c++ code into Python.

echo "Installing SWIG"

if [ ! -e swig-3.0.7.tar.gz ]; then
  wget -T 10 -t 3 \
    http://prdownloads.sourceforge.net/swig/swig-3.0.7.tar.gz || exit 1;
fi

tar -xovzf swig-3.0.7.tar.gz || exit 1
ln -s swig-3.0.7 swig

cd swig

# We first have to install PCRE.
if [ ! -e pcre-8.37.tar.gz ]; then
  wget -T 10 -t 3 \
    https://sourceforge.net/projects/pcre/files/pcre/8.37/pcre-8.37.tar.gz || exit 1;
fi
Tools/pcre-build.sh

./configure --with-pic
make
sudo make install

cd ..

I also installed the needed programs/libs:
https://github.com/Kitt-AI/snowboy#ubunturaspberry-pi
and compiled snowboy myself (the pre-compiled/provided version had the above error)
https://github.com/Kitt-AI/snowboy#compile-a-python-wrapper

@chenguoguo
Copy link
Collaborator

@richardfuchs could you give me the link of the pre-compiled version that doesn't work? I should fix that.

@richardfuchs
Copy link

richardfuchs commented Aug 13, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants