[Mapserver-users] Python mapscript - I fixed it!

Sean Gillies sgillies at frii.com
Mon Jun 16 13:03:21 PDT 2003


On Monday, June 16, 2003, at 08:10  AM, Vic Kelson wrote:

> Hooray!
>
> At Long Last, I have succeeded in making mapscript with python 
> compile, for mapserver-4.0b. I finally found the error, which is in 
> 'pymodule.i'. Here it is...
>
> The function  _raise_ms_exception() begins with the following code:
>
> static void _raise_ms_exception(void) {
>         char errbuf[256];
>         char errmsg[2048]; // room for up to 8 * 256 byte messages
>         int errcode;
>
>         strcpy(errmsg, "");
>         errorObj *ms_error = msGetErrorObj();
>         errcode = ms_error->code;
>
> The highlighted line is valid C++, but is not valid C (at least it 
> wasn't valid in my olden days as a C programmer, or according to 
> gcc-2.95). I have repaired this by separating the declaration and 
> assignment:
>
> static void _raise_ms_exception(void) {
>         char errbuf[256];
>         char errmsg[2048]; // room for up to 8 * 256 byte messages
>         int errcode;
>         errorObj *ms_error;
>
>         strcpy(errmsg, "");
>         ms_error = msGetErrorObj();
>         errcode = ms_error->code;
>
> and now it all compiles successfully on RedHat 7.3 and Debian (woody). 
> I also had to mangle setup.py to make it work on my system. I'll send 
> my changes to Sean Gillies, who has helped me out with this mess.
>
> THANKS for the help, folks!
> Vic
>
>
Vic,

Good work, man!  I will commit this to CVS.  While we're on the subject
of exceptions, are there any other MapServer errors that you'd like to
see mapped into Python exceptions?

cheers,
Sean


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




More information about the MapServer-users mailing list