Hi Dane

Yes, you have the idea.

I think you are probably on the right track with the User.  Apache runs as
'System' under Windows. The Registry is largely a mystery to me but a little
digging has thrown up references to the cmd line SETX command which has
options for setting environment variables at a system wide level - and which
looks to correspond to the HKEY set that I blindly edited, as directed by
that article. (SET, the normal way to modify environment variables can't do
that.) I'll do some experimenting tomorrow and check that using SETX works
reliably.

To get things going, I'm just using plain CGI but will probably migrate to
WSGI. I'm using 32 bit Apache  (I don't believe there is an official 64 bit
Windows binary yet.)

Thanks for the suggestions.

           Philip

On 13 May 2011 20:23, Dane Springmeyer <[email protected]> wrote:

> 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 <http://tilestache.org/>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

Reply via email to