[Tutor] Python 2.7.1 interpreter complains about NameError: global name 'levenshtein_automata' is not defined

Serdar Tumgoren zstumgoren at gmail.com
Tue Dec 28 02:38:19 CET 2010


It appears that you've defined "levenshtein_automata" as a method on your
DFA class, but you did not reference the class instance in your call by
prefixing "self". Instead, you're trying to call a globally defined function
named "levenshtein_automata" -- which because it is not defined, is throwing
a NameError.

Try changing line 145 to the below and see if that resolves the issue:

    lev = self.levenshtein_automata(word, k).to_dfa()  ######### line 145
##########
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20101227/03eaaf67/attachment.html>


More information about the Tutor mailing list