> import zipfile
> class walkZip(zipfile):
> pass
>
> if __name__ == "__main__":
> print "Hello World"
`zipfile' is the name of the module, not a class. What you probably
want is this:
[code]
import zipfile
class WalkZip(zipfile.ZipFile):
pass
if __name__ == "__main__":
print
Larry Bates wrote:
> import zipfile
> class walkZip(zipfile):
> pass
>
>
> if __name__ == "__main__":
> print "Hello World"
>
> Traceback (most recent call last):
> File "", line 192, in run_nodebug
> File "", line 2, in
> TypeError: Error when calling the metaclass bases
> modu
On Thursday 06 September 2007 16:15, Larry Bates wrote:
> I'm trying to learn about subclassing new style classes and the first
> project I went to do needs to subclass zipfile to add some methods.
>
>
> Why does this:
>
> import zipfile
> class walkZip(zipfile):
> pass
>
>
> if __name__ == "_
I'm trying to learn about subclassing new style classes and the first project I
went to do needs to subclass zipfile to add some methods.
Why does this:
import zipfile
class walkZip(zipfile):
pass
if __name__ == "__main__":
print "Hello World"
Traceback (most recent call last):