[mapserver-users] PythonMapscript Installation

Norman Vine nhv at cape.com
Tue Sep 24 06:12:09 EDT 2002


Grit Schuster writes:
>
> I tried to compile the pythonMapscript of the mapserver-3.6.1 package on
> SuSE.It doesnt work.
> It always stops with an error on the gcc command.
>
> I attached the shell output "gcc".
>
> I also compiled the pythonMapscript corresponding the recommendations of
> http://mapserver.gis.umn.edu/cgi-bin/wiki.pl?PythonMapScript.
>
> But this doesnt work anway. I attched the the shell output
"DisutilsExecError".

I don't have the 3-6.1 source so  I can't  really say why but
the swig command is failing so you never get a proper 'c' file built.

Syntax error
../mapscript.i:68. Syntax error in input.
../mapscript.i:74. Syntax error in input.

Did you modify your mapscript.i file as suggested in the WIKI ??

FYI
I have changed the copy of setup.py @
http://www.vso.cape.com/~nhv/files/python/setup.py
to now to exit on encountering a SWIG error
to make this clearer

Could someone please incorporate this change into
the CVS files.

note this consists of
1) adding the sys module to the list of imports
2) encapsulating 'spawn' in a try: except: block
     so that the script exits with an error message
     if swig returns an error code

HTH

Norman

==== cut ====
from distutils.core import setup, Extension
from distutils.spawn import spawn
from distutils.dir_util import mkpath
from distutils.file_util import copy_file
from distutils.sysconfig import parse_makefile,expand_makefile_vars
from string import split

import os,sys
from os import path

noisy=1
swig_cmd = ["swig",
            "-python",
            "-shadow",
            "-DPYTHON",
            "-DUSE_GD_PNG",
            "-DUSE_GD_JPEG",
            "-DWIN32",
            "-module",
            "mapscript",
            "-o",
            "./mapscript_wrap.c",
            "../mapscript.i" ]

try:
    spawn(swig_cmd, verbose=noisy)
except:
    print "\nSwig error"
    raise sys.exit()

====  no change past here ====




More information about the mapserver-users mailing list