[Tilecache] Patch: fixes ImportError in our cases
Gregor Mosheh
gregor at hostgis.com
Sat Aug 9 14:51:36 EDT 2008
Hi, all. I have two patches to contribute, and apparently sending them
to the list is the preferred way of doing so.
Problem: The existing import statements in Service.py were causing
ImportError exceptions when run from the command line. While a
PYTHONPATH could have solved this, this solution makes the imports more
robust when running from the command line, e.g. in tilecache_seed.py
This diff was from TC 2.01 but should apply to 2.04 as well.
--- Service.old.py 2008-08-09 11:28:35.000000000 -0700
+++ Service.py 2008-08-09 11:29:10.000000000 -0700
@@ -5,8 +5,12 @@
class TileCacheException(Exception): pass
import sys, cgi, time, os, traceback, ConfigParser
-from TileCache import Cache, Caches
-from TileCache import Layer, Layers
+try:
+ from TileCache import Cache, Caches
+ from TileCache import Layer, Layers
+except ImportError:
+ import Cache, Caches
+ import Layer, Layers
# Windows doesn't always do the 'working directory' check correctly.
if sys.platform == 'win32':
More information about the Tilecache
mailing list