Going through django tutorial for a second time and was disheartened to get a weird error when trying to log in as admin:
pcw@intranet:~/django_src$ ~/django_admin.py runserver
Validating models...
0 errors found.
Starting server on port 8000 with settings module 'djangotutorial.settings'.
Go to http://127.0.0.1:8000/ for Django.
Quit the server with CONTROL-C (Unix) or CTRL-BREAK (Windows).
[01/Nov/2005 07:15:52] "GET /admin/ HTTP/1.1" 200 1615
Traceback (most recent call last):
File "/home/pcw/django_admin.py", line 131, in ?
main()
File "/home/pcw/django_admin.py", line 108, in main
ACTION_MAPPING[action](addr, port)
File "/usr/lib/python2.4/site-packages/django/core/management.py",
line 656, in runserver
autoreload.main(inner_run)
File "/usr/lib/python2.4/site-packages/django/utils/autoreload.py",
line 71, in main
reloader_thread()
File "/usr/lib/python2.4/site-packages/django/utils/autoreload.py",
line 44, in reloader_thread
mtime = os.stat(filename).st_mtime
OSError: [Errno 2] No such file or directory:
'/usr/lib/python2.4/site-packages/django/templatetags/adminmedia.py'
Error in atexit._run_exitfuncs:
Traceback (most recent call last):
File "/usr/lib/python2.4/atexit.py", line 24, in _run_exitfuncs
func(*targs, **kargs)
File "/usr/lib/python2.4/threading.py", line 636, in __exitfunc
self._Thread__delete()
File "/usr/lib/python2.4/threading.py", line 522, in __delete
del _active[_get_ident()]
KeyError: -1209573248
Error in sys.exitfunc:
Traceback (most recent call last):
File "/usr/lib/python2.4/atexit.py", line 24, in _run_exitfuncs
func(*targs, **kargs)
File "/usr/lib/python2.4/threading.py", line 636, in __exitfunc
self._Thread__delete()
File "/usr/lib/python2.4/threading.py", line 522, in __delete
del _active[_get_ident()]
KeyError: -1209573248
Unhandled exception in thread started by
Error in sys.excepthook:
Original exception was:
ugly, huh? Looks like three stack traces, two of which are the same. Where to start. Well I think this line is the clue:
OSError: [Errno 2] No such file or directory: '/usr/lib/python2.4/site-packages/django/templatetags/adminmedia.py'
Looking in /usr/lib/python2.4/site-packages/django/templatetags/ I see adminmedia.pyc but no adminmedia.py. I think what has happened is that updating django by doing
svn update
does not clear out the python .pyc files that are generated automaticaly by python. The django autoreload code is seeing the .pyc files and looking for the corresponding .py files. I deleted the .pyc files and life went on.
Twitterings

The incantation to delete the .pyc files is:
Peter