Ticket #273 (defect)
Opened 3 years ago
Last modified 3 years ago
autoreload fails with python eggs
Status: closed (fixed)
| Reported by: | poissonnier@gmail.com | Assigned to: | rdelon |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | CherryPy code | Keywords: | autoreload zip |
| Cc: | poissonnier@gmail.com |
I have several python modules installed as python eggs (http://peak.telecommunity.com/DevCenter/PythonEggs) and the autoreloader fails when the egg is stored as a zipfile. I guess the reloader will also fail with non-egg modules stored as zipfiles. With CherryPy-2.1.0-beta the autoreloader exists with "OSError: [Errno 20] Not a directory: ... " while the current SVN version goes into an infinite loop. The relevant part in the SVN version is: cherrypy/lib/autoreload.py:19-22 try:
mtime = os.stat(filename).st_mtime except OSError: sys.exit(3) # force reload
I *think* this should just continue when it encounters an OSError as it is quite unlikely that the files within the zip module will be changed: try:
mtime = os.stat(filename).st_mtime except OSError: continue
I had a look at reloader.py from Paste (WSGIKit) and it does the same: try:
mtime = os.stat(filename).st_mtime except (OSError, IOError): continue
Change History
09/11/05 01:41:16: Modified by fumanchu
10/28/05 10:38:36: Modified by ianb@colorstudy.com
One thing I've thought about doing in Paste -- but have not -- is test os.access, and only re-test files that are writable. But this presumes in development mode that you are running the app as a user that would typically be able to write to in-development files, which might be inaccurate.
Another interesting algorithm would be to test how old the file is. Old files aren't edited often, and can be tested less often.
Anyway, I'd be quite interested with moving this reloading functionality to a separate package, since there are actually quite a lot of potential features it could have (e.g., using a file monitoring daemon), and it's being used by a couple different projects (I think Django also uses it). If you are interested in this, please contact me.
11/13/05 16:17:16: Modified by peterhunt
- status changed from new to closed.
- resolution set to fixed.
fixed in [817]


See #290 for more info.