“There is a maker’s serial number 9906947-XB71. Interesting. Not fish. Snake scale.” Blade Runner has shown how tell a real snake from a replicant snake: (Sys.Version). Beyond the superficial, what happens when we take the animoid IronPython , and attempt to replace CPython in a real-world battlefield? I chose MetaCarta’s TileCache.
For those who don’t know, IronPython is MS’s implementation of Python on top of .NET. Its pre-release software in the context of running it from ASP.NET, and therefore against the pre-release license to benchmark. I won’t be doing that; nor do I need to. The purpose is to see if IronPython is a drop-in replacement for CPython. To be fair, I know next to nothing about Python in either implementation.
It took me less than 30 minutes to set up TileCache using CPython and CGI on MS’s IIS. The directions weren’t 100%, but anybody with a clue can fill in the blanks. Hint: IIS has no default CGI handler.
IronPython right now is much trickier. I put about two hours into it, and didn’t get TileCache running in that time. I did finally get everything to compile, but it took some work. The basic problem is that IronPython won’t import compiled C/C++ modules. The IronPython developers are aware of this, and will supposedly replace these compiled modules with .NET equivalents as time permits.
For now, IronPython doesn’t ship with standard library equivalents, and must reference CPython’s modules, many of which in turn reference compiled C/C++ modules. TileCache references script modules that reference the “hashlib” compiled module, even though I’m pretty sure that TileCache doesn’t use these.
After a long, uneducated process to track down where “hashlib” was being imported, it was easy to comment out. After this, TileCache would run, but it didn’t do anything. I was just getting back zero-byte responses, because TileCache’s CGI-specific code needs porting to the ASP.Net environment. To a .NET developer, the nice part is that VisualStudio’s debugging tools made it simple to track down this problem.
Winners: CPython, because it already works just fine
Losers: Impatient developers? People who waste time evaluating beta products?
June 20, 2007 at 11:53 am |
[...] was inspired by Bill Thorp’s efforts to get TileCache working on IronPython: Round 1, Round 2. However, I’m not all that inspired [...]
July 21, 2007 at 1:01 am |
Hi, i have a couple days traying to install TileCache on IIS 5.1, but i fail in the process… What i did is…
1. First i download ActivePython2.5.0.0, and install it.
2. I follow the instucctions on the site http://support.microsoft.com/kb/276494,creating the virtual directory and given the permissions
3. I cannot do the 3rd step, change the metabase.xml, because i don’t know where it is?
4. I edit the tilecache.cgi, in this way…
!C:/Python25/python.exe -u
from TileCache import Service, cgiHandler, cfgfiles
if __name__ == ‘__main__’:
svc = Service.load(”C:/Inetpub/wwwroot/tilecache/tilecache.cfg”)
cgiHandler(svc)
5. I edit the tilecache.cfg
[cache]
type=DiskCache
base=C:\Inetpub\wwwroot\tilecache\tmp
[base]
type=WMSLayer
url=http://localhost/mapserver/cgi-bin/mapserv.exe?map=/ms4w/apps/metro/map/metro.map
layers=limiteurbano,isla,red250k,red100k,corregimiento250k
extension=png
size=256,256
bbox=-79.64,8.89,-79.29,9.17
srs=EPSG:4326
levels=20
resolutions=1.40625,0.703125,0.3515625,0.17578125,0.087890625,0.0439453125,0.02197265625,0.010986328125,0.0054931640625,0.00274658203125,0.00137329101
metatile=false
metaSize=5,5
metaBuffer=10
i call de tilecache.cgi from OpenLayers, but it doesn’t seems to work properly (i just get pink tiles), and when i use the firefox browser and put the url:
http://localhost/tilecache/tilecache.cgi?layers=base
i get this message:
%1 is not a Win32 valid application
thanks!
I will be really thanxfull if someone can give me a hand about this subject…
July 21, 2007 at 5:03 pm |
That error basically says IIS does not know what to do with CGI files. The easiest solution if you followed the other directions is to remove the first line of tilecache.cgi and rename it to tilecache.py. Alternatively, delete the first line, then repeat step 2 from the MS article, telling python to run CGI files as well.