|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stop making mediocre tutorials.The best tutorials are video! Camtasia Studio makes it easy to create engaging, buzz-building screen videos at any size, in any popular format. Download the free trial!
|
|
#1
|
||||
|
||||
|
Problem running a python script
I'm a newbie at python, but I'm trying to run this script: http://www.mnot.net/cacheability/
I've got it setup as a cgi script and it executes, but I get this error: Code:
Traceback (most recent call last):
File "/var/www/apache2-default/cgi-bin/cacheability.py", line 902, in cgi_wrap
cgi_main()
File "/var/www/apache2-default/cgi-bin/cacheability.py", line 871, in cgi_main
print "
", f, "
"
File "/var/www/apache2-default/cgi-bin/cacheability.py", line 111, in __repr__
p(" %s\n" % (
File "/var/www/apache2-default/cgi-bin/httpheadertypes.py", line 280, in __getattr__
return self.__dict__[attr]
KeyError: '__str__'
Does this mean anything to anyone? Is there a way I can trace this error and fix it? TIA
__________________
Wireless Forums |
|
#2
|
|||||
|
|||||
|
This seems to be caused by the scripts __getattr__ method attempting to return a value from the objects attribute dictionary that doesnt exist (the problem is __getattr__ is only called if the value doesnt exist in __dict__ in the first place, so why who ever wrote this thought that was a good idea is beyond me
)anyway someone already posted the solution to this on the python mailing list, what you need to do is access the file httpheadertypes.py and find the Dict.__getattr__ method override and replace it with the following Python Code:
I've given this a quick test(far from extensive) and it seems to work now. Hope this helps. You can find the original mailing list entry about this problem here: http://starship.python.net/pipermai...005/000484.html Last edited by c-2501 : April 16th, 2008 at 05:02 PM. Reason: found better version of method edit |
|
#3
|
||||
|
||||
|
Thank you so much, I searched everywhere for a solution to this problem. Not knowing python made it a bit harder to sort out.
|
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Python Programming > Problem running a python script |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|