Bug in v1.5.2 Websucker GUI?
David Friedman
dhfx at realtime.net
Sun May 30 22:06:10 EDT 1999
I'm running v1.5.2 on a Win95 box. I tried wsgui.py and got the
following error message:
...
File "C:\ ... \WSGUI.PY", line 165, in go
self.sucker.rootdir = os.path.dirname(
[ websucker.Sucker.savefilename(self.url)) ]
TypeError: unbound method must be called with class instance 1st arg
(the part in [ ] didn't appear in the message - I added it from the code)
The object-instance self.sucker is an instantiation of class SuckerThread,
which is derived from class Sucker of the websucker code module. The
SuckerThread class includes a method savefilename() which overwrites
the method in websucker.Sucker of the same name. Whoever coded wsgui
evidently wanted to use the method of the parent class, rather than the
method of the derived class. What seems to be giving trouble is that the
arg of dirname() is a class method, rather than a method of an instance
of the class.
Here's what I did: I defined a new method savefilename1() in SuckerThread
which just calls the savefilename() of the parent class:
def savefilename1(self, url):
return websucker.Sucker.savefilename(self, url)
Then I changed the code at "line 165" to the following:
self.sucker.rootdir = os.path.dirname(
self.sucker.savefilename1(url))
and now it works. Note that the arg "self" of savefilename1() in the line
above is not needed, it's implicit. In fact, when I had it in, I got an
error message that I had too many args!
David Friedman
More information about the Python-list
mailing list