I got lucky yesterday and stumbled across a solution which has been right in front of me on the failing line. My problem seems to be rooted in Python. I wrote the following with the intention of posting to the Python bug list. Does this sound reasonable?
TypeError: unbound Method I sometimes receive the following error: TypeError: unbound method getImage() must be called with UnboundMethodError instance as first argument (got UnboundMethodError instance instead) As the message states, the required object instance is the same as the object instance passed. The problem occurs only when using the calling form: className.methodName(self,arg,..) and an easy workaround is to use the form: self.methodName(arg,...) The error occurs rarely and unpredictably on both Linux and Windows/ME using Python 2.1.1 and 2.2.1 (ActiveState distribution on Windows) in a web application that uses Apache as a web server and the Webware/WebKit application framework. I was able to recreate the problem in a simple test case. See: http://www.users.qwest.net/~haaserd/Unbound/UnboundMethod.html http://www.users.qwest.net/~haaserd/Unbound/UnboundMethodError.py http://www.users.qwest.net/~haaserd/Unbound/Error1.html http://www.users.qwest.net/~haaserd/Unbound/Error2.html Note: UnboundMethod.html will fail to load images, do a view source. When loaded in its required environment, UnboundMethod.html displays 12 images by requesting a Webware/WebKit servlet: <img src="UnboundMethodError?fileName=P10100xx.JPG"> The Webware/WebKit AppServer passes control to the writeHTML function within the UnboundMethodError.py script. This forms a fully qualified filename and passes it to the getImage function via: img = UnboundMethodError.getImage(self,fileName,1000) The two html pages error1.html and error2.html are the Webware/WebKit formatted abends from 2 of the 12 invocations which failed at the above statement. The failing images in this case were numbers 3 and 8. The other 10 images were displayed correctly. For normal processing, the writeHTML function calls getImage. The recursive calls made by getImage were an unsuccessful attempt to increase the number of errors. The getImage2 function uses PIL to read the JPG file, reduce it to a thumbnail, and return the image. Until about one month ago, this error has occurred perhaps 20 times over a year on an AMD Athlon 700 and AMD Duron 1000 using Python 2.1.1 on both Linux and Windows/ME. The failure occurred in a script ShowPix.py which is more complex than the test case above. The usual circumstances were Apache and MySQL (and perhaps several other applications) were running, the Webware/WebKit AppServer is started/restarted and (rarely) the first transaction to display an image using ShowPix.py would fail on the unbound method error. After the first failure, there were no additional failures. I should note I am retired and doing this as a hobby so the 20 errors over a year occurred during 300 - 500 hours of programming and testing. Within the last month I changed my test system over to an Intel 1.5 and downloaded more current versions of all software, including Python 2.2.1 (ActiveState distribution under Windows) and the frequency of the error has increased. Instead of just the one failure described above, now when the problem occurs (immediately after starting/restarting the Webware AppServer) about 20% of the ShowPix.py transactions displaying images fail. In a web page which displays 9 to 100 images, the failing instances are scattered more or less evenly over the page. Redisplaying the same page results in about the same number of errors but a different set of images fail with each reload of the page. All pages using the ShowPix.py script will continue to produce failures at about the 20% rate until I restart the Webware Appserver. I have been unable to establish a cause/effect relationship as to why this error sometimes occurs. I suspect it is related to my starting another unrelated application such as MS Word or Excel, etc. during the course of my testing. I can not make the error occur on demand, and was only able to provide the test case above by creating the script during one of the recent failing episodes before restarting the Webware AppServer. Also, I have been unable to recreate the problem over a 3 hour period by running only the simple test case and restarting the AppServer many times. So there may be some other curious code in my Python-only application which sets up the error condition. I should note the original failing module (ShowPix.py) is one of my first Python programs written when I used the className.methodName(self) style of calls. When I changed the abending statement to the self.methodName() form, the error in ShowPix.py moved to a second instance of the className.methodName style of call. When I changed all of the calls within ShowPix.py to the self.methodName, the errors stopped and I took the opportunity (before stopping the AppServer) to write the test case described above. If you need any other information, I can be reached at [EMAIL PROTECTED] Roger Haase On Friday 12 July 2002 05:32 am, Geoff Talvola wrote: > On Thu, 2002-07-11 at 15:06, Roger wrote: > > Any ideas on what to try next? > > Not really. Are you willing to send me a copy of your code and the full > traceback you're getting? I think I need to actually see the code to > try to understand what's wrong. > > - Geoff ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Webware-discuss mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/webware-discuss