Philip, So basically you are saying that mapnik works on the command line but when using within Apache you get and 'ImportError' when running `import mapnik` ?
I would assume that this is because Apache runs as a different user (at least it does on unix, no idea on windows) and does not have the same environment settings (PYTHONPATH) that you set when you installed mapnik initially. So, you would either need to make the PYTHONPATH="C:\Program Files (x86)\mapnik-0.7.1\python\2.6\site-packages" at a system level (so Apache would pick it up) or set it use mod_python or mod_wsgi's methods (which one are you using?). One gocha - you are on a 64 bit machine, but is Apache running 64 bit or 32? Dane On May 13, 2011, at 11:22 AM, Philip Howarth wrote: > Hello List, > > I'm not sure if the issue that has been puzzling me is fundamentally mapnik, > apache, windows or some combination... > > I've been setting up TileStache on a Windows 7 (64 bit) box to work with > Apache 2.2, Python 2.6.5, mapnik 0.7.1, postgreSQL 8.4/postgis 1.5 > The python/mapnik/Apache/python installation works fine and has been for some > time. I have a number of python scripts that create static maps and tiles > with no problem. > > Initially, I got TileStache cacheing tiles from OSM to prove the basic > installation - no problem. Adding map generation, using mapnik, to > TileStache exposed an odd problem. I could not get any python script which > was invoked by apache (using CGI for simplicity) to import mapnik. ( I > removed all the TileStache code and created a very minimal cgi script that > did little more than import mapnik to prove this. The same script invoked > manually, by cmd line or using idle, imported mapnik without complaint. > > I suspected problems with paths or permissions and double checked pythonpath, > mapniklibpath, httpd.conf, folder properties etc. I eventually unearthed > (from http://www.imladris.com/Scripts/PythonForWindows.html) a fix that > involved adding a registry key that points at C:\Program Files > (x86)\mapnik-0.7.1\python\2.6\site-packages (I know that is not where the > standard installation instructions suggest but it is where I have always put > mapnik - editing ...python\2.6\site-packages\mapnik\paths.py to suit.) > > This now works and TileStache is drawing maps on demand and cacheing as I'd > hoped. Using Regedit to add a registry key feels like more of a hack than a > fix, though. Can anyone suggest what I should have done instead? > > Philip > > -- > Philip Howarth > Cambridge UK > email: [email protected] > _______________________________________________ > Mapnik-users mailing list > [email protected] > https://lists.berlios.de/mailman/listinfo/mapnik-users
_______________________________________________ Mapnik-users mailing list [email protected] https://lists.berlios.de/mailman/listinfo/mapnik-users

