python-3.xpocketsphinx

'config' is not defined Pocketsphinx Python


I've imported the modules:

from pocketsphinx.pocketsphinx import *
from sphinxbase.sphinxbase import *

The LiveSpeech module is working and I am trying to disable the logs using:

config.set_string('-logfn', '/dev/null')

Although I get the following error:

Traceback (most recent call last): File "/home/pi/Downloads/Test.py", line 23, in config.set_string('-logfn', '/dev/null')

NameError: name 'config' is not defined**


Solution

  • You need to create config like this:

    config = Decoder.default_config()
    config.set_string('-logfn', '/dev/null')
    decoder = Decoder(config)