newbie class troubles

Roland Schlenker rol9999 at attglobal.net
Sun Sep 17 17:12:50 EDT 2000


That error message means you need to call the method as

filesearch().search() or

f = fileserch()
f.search()

You need to create an instance before calling the method.

Roland Schlenker

Brett Lempereur wrote:

> erm... no. my code at the minute is:
>
> class filesearch:
>     # Any public variables i need
>     exceptions = []
>     filelist = []
>     dirlist = []
>
>     def search(self, top):
>         try:
>             tmpList = os.listdir(top)
>         except os.error:
>             return
>
>         for item in tmpList:
>             if item not in exceptions:
>                 name = os.path.join(top, name)
>                 if os.path.isdir(name):
>                     self.dirlist.append(name)
>                     search(self, name)
>                 else:
>                     self.filelist.append(name)
>
> that's the class.  you already know the error



More information about the Python-list mailing list