On Tue, Dec 23, 2008 at 9:31 AM, Omer <jaggojaggo...@gmail.com> wrote:

>>>> from urllib import urlopen
>>>> class fetch(urlopen):
> ...     def __init__(self,*args):
> ...         urlopen.__init__(self, *args)
> ...         self.content = self.read()
> ...
>
> Traceback (most recent call last):
>   File "<interactive input>", line 1, in <module>
> TypeError: Error when calling the metaclass bases
>     function() argument 1 must be code, not str
>
> Anybody, any idea what's up with that?

That's pretty obscure, not sure why you get exactly that error!

Anyway the code should be
class fetch(object):

urlopen is a function, not a class, so it can't be a base class of
fetch. There is no need for it to be a base class, either; just use
object.

Kent
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to