I get the following error during page load:
Internal Server Error: /
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\django\core\handlers\base.py", line 92, in get_response
response = middleware_method(request)
File "C:\Python27\lib\site-packages\django_debug_toolbar-0.9.4-py2.7.egg\debug_toolbar\middleware.py", line 100, in process_request
File "C:\Python27\lib\site-packages\django_debug_toolbar-0.9.4-py2.7.egg\debug_toolbar\panels\timer.py", line 30, in process_request
self._start_rusage = resource.getrusage(resource.RUSAGE_SELF)
AttributeError: 'module' object has no attribute 'getrusage'
[03/Apr/2013 13:11:08] "GET / HTTP/1.1" 500 62374
django-debug-toolbar (0.9.4) - commit 6f79f0b
Also doesn't work on the 0.9.4 release... that's why I took the latest from the repo.
Having the same issue on OSX..
FYI, my work-around was to disable debug_toolbar.panels.timer.TimerDebugPanel. This was my setting for DEBUG_TOOLBAR_PANELS:
DEBUG_TOOLBAR_PANELS = (
# Throwing AttributeError: 'module' object has no attribute 'getrusage'
Hope this helps. The downside of course is that there's no timing functionality, but at least the other functionalities work. It would be nice if there was a real fix...
Thanks for the reply, i 'resolved' the issue in the same way.
Hopefully posting will help support people in finding the cause :).
Agreed, I'm sure there are others with the same problem, thanks for posting.
One thing worth asking, do you happen to have another module named resource that is being imported instead of the standard lib resource?
Ah yes I have a django application with the package "resource". Now it makes sense... thanks for pointing that out! I haven't tried removing it yet as it's being used, but I'm sure that's likely the problem.
The resource module is only available on Unix, hence the problem on Windows (regardless of the shadowing issue discussed above). At least two solutions could work:
In fact the code already deals with the case when the resource module doesn't exist.
I believe all the errors above are caused by shadowing the stdlib resource module with a local module.
It's a Python gotcha and there's not much we can do about it.