[MS4W-Users] Problem during importing mapscript in python

Sajid Anwar sajid.khatana at gmail.com
Sat Dec 28 23:54:56 EST 2013


Dear all,

i new to MapServer, and need some programming to make the (.map) file
reusable for arbitrary shapefile(map rendering) which is part of my M.Sc
research. For this i need to install Mapscript with python,i  follow all
the instructions on MapServer read me file for python .Moreover i m using
python 2.6.2 and MapServer  MS4W - MapServer 4 Windows - version 3.0.6.
After following all the steps i got the following message:
IDLE 2.6.2
>>> import mapscript

Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    import mapscript
  File "C:\ms4w\Apache\cgi-bin\mapscript.py", line 25, in <module>
    _mapscript = swig_import_helper()
  File "C:\ms4w\Apache\cgi-bin\mapscript.py", line 24, in swig_import_helper
    return _mod
UnboundLocalError: local variable '_mod' referenced before assignment

The line 24 and 25 are as follow....................

(

from sys import version_info
if version_info >= (2,6,0):
    def swig_import_helper():
        from os.path import dirname
        import imp
        fp = None
        try:
            fp, pathname, description = imp.find_module('_mapscript',
[dirname(__file__)])
        except ImportError:
            import _mapscript
            return _mapscript
        if fp is not None:
            try:
                _mod = imp.load_module('_mapscript', fp, pathname,
description)
            finally:
                fp.close()
    * Line24 *         return _mod
   *Line 25* _mapscript = swig_import_helper()
    del swig_import_helper

)

Best Regard
and

Thanks in advance..............
Sajid
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/ms4w-users/attachments/20131229/41e65c2c/attachment.htm 


More information about the MS4W-Users mailing list