On 18.03.2011 21:13, monkeys paw wrote:
I have the following file:

FileInfo.py:

import UserDict

After this import statement, the name "UserDict" refers to the module.

class FileInfo(UserDict):

Here you are trying to subclass the module. What you need instead is:

class FileInfo(UserDict.UserDict):

Alternatively, import the UserDict class from the UserDict module like so:

from UserDict import UserDict

Note, that the UserDict class is obsolete, you can subclass the dict type directly:

class FileInfo(dict):
    "store file metadata"
    def __init__(self, filename=None):
        dict.__init__(self)
        self["name"] = filename
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to