class error
Ethan Furman
ethan at stoneleaf.us
Fri Mar 18 16:50:07 EDT 2011
monkeys paw wrote:
> I have the following file:
>
> FileInfo.py:
>
> import UserDict
>
> class FileInfo(UserDict):
> "store file metadata"
> def __init__(self, filename=None):
> UserDict.__init__(self)
> self["name"] = filename
>
>
>
> When i import it like so:
>
> import FileInfo
>
>
> i get this error:
>
> Traceback (most recent call last):
> File "<interactive input>", line 1, in <module>
> File "FileInfo.py", line 3, in <module>
> class FileInfo(UserDict):
> TypeError: Error when calling the metaclass bases
> module.__init__() takes at most 2 arguments (3 given)
>
> What is causing the error?
UserDict is a module -- you want to subclass the UserDict class inside
the module...
class FileInfo(UserDict.UserDict):
"etc etc"
~Ethan~
More information about the Python-list
mailing list