I ran microphne.py in ras-pi 4 and next error happend.
Please tell me how to correct the error
i.e.
Exception in thread Thread-1:
Traceback (most recent call last):
File “/usr/lib/python3.7/threading.py”, line 917, in _bootstrap_inner
self.run()
File “/usr/lib/python3.7/threading.py”, line 865, in run
self._target(*self._args, **self._kwargs)
File “microphone.py”, line 330, in task
mic = Microphone(quit_event=quit_event)
File “microphone.py”, line 109, in init
self.decoder = decoder if decoder else self.create_decoder()
AttributeError: ‘Microphone’ object has no attribute ‘create_decoder’
(at File “microphone.py”, line 109, in init)
Attribute errors in Python are generally raised when you try to access or call an attribute that a particular object type doesn’t possess. It’s simply because there is no attribute with the name you called, for that Object. This means that you got the error when the “module” does not contain the method you are calling. But it is evident that the method is there, which leads to believe that may be the method was added by you in the source code after you had already imported the file (module). Or, some times packages get deprecated and they rename some functions. If that is true, then you may want to exit and reimport the module once again to be able to access the new method .
You can do it in another way to reimport the module with changes without having to exit the interpreter is to do the following:
reload(myModule)
If you are using python 3.2 or 3.3 you should:
import imp
imp.reload(myModule)
If running Python 3.4 and up, do import importlib, then do:
import importlib
importlib.reload(myModule)
The importlib.reload() method reload a previously imported module. The argument must be a module object, so it must have been successfully imported before .