[Tutor] Python 2.7.1 interpreter question

Alan Gauld alan.gauld at btinternet.com
Wed Dec 29 21:33:26 CET 2010


"Frank Chang" <frankchang91 at gmail.com> wrote 
> automata.py. The pastebin url for automata.py is:
> <iframe src="http://pastebin.com/embed_iframe.php?i=J9MRPibX"
> style="border:none;width:100%"></iframe>

>    list(automata.find_all_matches('nice', 1, m))
> AttributeError: 'module' object has no attribute 'find_all_matches'

find_all_matches() is a method of a class. Therefore you need to 
call it via an instance of that class. You need to instantiate the 
class using the module name but after that the object will be 
local:

myObj = module.myclass()
myObj.myMethod()

HTH,







More information about the Tutor mailing list