[Tilecache] mod_python, again

Yves Moisan yves.moisan at boreal-is.com
Tue Mar 10 16:33:56 EDT 2009


Hi All,

I thought I had settled the issue before, but it doesn't seem so.  I got
TC working on Python 2.4 with mod_python 3.2.7.  At the time, I had
noted that mod_python 3.3.1 did not work with TC.  

Now, I'm setting up a new server and want to upgrade Python, so I go
with 2.5.2.  There's no mod_python 3.2.7 for Python 2.5 ... so I grab
3.3.1.  And problems begin.

What works :

mod_python : 

- the mptest.py test on the mod_python page
(http://www.modpython.org/live/current/doc-html/inst-testing.html) works
so I assume this means everything is ok mod_python wise

tilecache :

- cgi works :
http://localhost:8888/tilecache/tilecache.cgi/1.0.0/basic/0/0/0.png

http://localhost:8888/tilecache/tilecache.py/1.0.0/basic/0/0/0.png gives

An error occurred: No section: 'cache'
  File "C:\Program Files\MyDir\ms4w\Apache\htdocs\tilecache\TileCache
\Service.py", line 96, in _load
    cache = cls.loadFromSection(config, "cache", Cache)
  File "C:\Program Files\MyDir\ms4w\Apache\htdocs\tilecache\TileCache
\Service.py", line 51, in _loadFromSection
    type  = config.get(section, "type")
  File "C:\Program Files\MyDir\Python25\lib\ConfigParser.py", line 511,
in get
    raise NoSectionError(section)

NOTE :  The Apache logs show that mod_python's path is not altered by
setting the PythonPath directive in httpd.conf.  IOW, the PythonPath
directive has no effect whatsoever on windows ...  The only way to get
the nice error message shown above is to force the tilecache paths into
the registry PythonPath variable.  Without that, I get an Internal
Server Error (and corresponding "ImportError: No module named
TileCache.Service" entry in Apache log).  

Now, I have a cache section in my cfg file or else CGI wouldn't work.
Looking at the first line in the error, I see there is a path problem.
Next are the relevant bits of files; I can't see what's wrong with my
paths :

tilecache.cfg
...
[cache]
type=Disk
base=C:/Program Files/MyDir/GeoData
...

with the regular basic layer

httpd.conf
...
# TileCache, mode CGI
    <Directory htdocs/tilecache/>
         AddHandler cgi-script .cgi
         Options +ExecCGI
    </Directory>

# TileCache, mode mod_python	
<Directory htdocs/tilecache/>
    AddHandler python-program .py
#	PythonPath "['C:/Program
Files/MyDir/ms4w/Apache/htdocs/tilecache/TileCache', 'C:/Program
Files/MyDir/ms4w/Apache/htdocs/tilecache'] + sys.path"
# Previous line has no effect on path used by mod_python
    PythonHandler TileCache.Service 
    PythonOption TileCacheConfig "C:/Program
Files/MyDir/ms4w/Apache/htdocs/tilecache/htdocs/tilecache/tilecache.cfg"
</Directory>
...

Thanx for pointers,

Yves





More information about the Tilecache mailing list