[Mapserver-users] Installing Python Mapscript

Sean Gillies sgillies at frii.com
Thu Jul 29 10:56:26 PDT 2004


On Jul 29, 2004, at 11:08 AM, William Hudspeth wrote:

> Hello all,
>
> I am trying to install Python Mapscript. I have run "python setup.py 
> install" in the /mapscript/python directory. When I try to import 
> mapscript,
>
> >>>import mapscript
>
>
> I get :
>
> ImportError: No module named _mapscript
>
> What might be the problem?
>
> Thanks, Bill
>

Bill,

Here's my first guess at the problem, a gotcha that I've experienced.

The mapscript module is configured in such a way that the
Python interpreter expects to find both mapscript (aka mapscript.py)
and _mapscript (aka _mapscript.so or _mapscript.pyd) side-by-side
somewhere in your PYTHONPATH.

After the install, mapscript.py and _mapscript.so (I'm assuming linux)
are copied to /usr/lib/python/lib/site-packages or something like that.
However, the current working directory remains at the head of your
PYTHONPATH.  This allows modules in your working directory to override
installed modules.

At any rate, change directory to any other location, and try again
to import mapscript -- you'll get the installed modules.

cheers,
Sean

--
Sean Gillies
sgillies at frii dot com
http://users.frii.com/sgillies




More information about the MapServer-users mailing list