[mapserver-users] Building Mapscript/Python

Doyon, Jean-Francois Jean-Francois.Doyon at CCRS.NRCan.gc.ca
Tue Aug 21 10:37:01 EDT 2001


Hello,

I'm trying to build a Mapscript module for Python 2.1 out of the CVS
version, and am having some problems. I was wondering if anybody has
succeeded?

I've done:

cd mapserver/mapscript/python
ln -s ../mapscript.i mapscript.i
swig -shadow -python mapscript.i
gcc -c mapscript_wrap.c -I/usr/include/python2.1 -o mapscriptcmodule.o
ld -shared mapscriptcmodule.o -o mapscriptcmodule.so

This all works fine, this is the latest SWIG 1.3.6 ...

BUT When I try to import the module:

Python 2.1.1 (#1, Jul 26 2001, 04:57:14) 
[GCC 2.96 20000731 (Red Hat Linux 7.1 2.96-81)] on linux2
Type "copyright", "credits" or "license" for more information.
>>> import mapscript
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "mapscript.py", line 2, in ?
    import mapscriptc
ImportError: ./mapscriptcmodule.so: undefined symbol: ms_error
>>> 

I checked the interface file, and it does look like the ms_error symbol
isn't defined! (Used, but not defined):

#ifdef SWIGPYTHON
// For Python, errors reported via the ms_error structure are translated
// into RuntimeError exceptions. (Chris Chamberlin <cdc at aracnet.com>)
%{
  static void _raise_ms_exception(void) {
    char errbuf[256];
    snprintf(errbuf, 255, "%s: %s %s\n", ms_error.routine,
msGetErrorString(ms_error.code), ms_error.message);
    _SWIG_exception(SWIG_RuntimeError, errbuf);
  }

  #define raise_ms_exception() { _raise_ms_exception(); return NULL; }
%}

%except {
  $function
    if ( (ms_error.code != MS_NOERR) && (ms_error.code != -1) )
      raise_ms_exception();
}
#endif // SWIGPYTHON

The above is the only section of the file that refers to ms_error ... which
somehow seems wrong ...

Anyone ?

Thanks!


Jean-François Doyon
Internet Service Development and Systems Support
GeoAccess Division
Canadian Center for Remote Sensing
Natural Resources Canada
http://atlas.gc.ca
Phone: (613) 992-4902
Fax: (613) 947-2410




More information about the mapserver-users mailing list