Bug in v1.5.2 Websucker GUI?
Anton Vredegoor
anton at vredegoor.doge.nl
Wed Jun 11 17:52:51 EDT 2003
On 30 May 1999 21:06:10 -0500, dhfx at realtime.net (David Friedman)
wrote:
> 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!
Well, it's about four years later now and the specific code in
wsgui.py seems to be unchanged. I can perhaps add that it only happens
if something is entered in the directory entry box since that triggers
the traceback.
On Win98Se, Python23:
>d:\python23\pythonw -u wsgui.py
Exception in Tkinter callback
Traceback (most recent call last):
File "D:\PYTHON23\lib\lib-tk\Tkinter.py", line 1337, in __call__
return self.func(*args)
File "wsgui.py", line 163, in go
self.sucker.rootdir = os.path.dirname(
TypeError: unbound method savefilename() must be called with Sucker
instance as first argument (got App instance instead)
>Exit code: 0
I would be in favor of finally fixing this, unless it would result in
backwardly incompatible changes :-)
Anton
---
nobody and ghosts from the past read comp.lang.python
More information about the Python-list
mailing list