Le 01/31/2014 11:23 AM, Tim Banchi a écrit :
Hello,

with the upate from ubuntu 13.04 to 13.10 the package python-mapscript moved from 6.0.1 to 6.2.1. Since then I get the the following runtime error:

img = mapscript.imageObj(fname)
File "/usr/lib/python2.7/dist-packages/mapscript.py", line 1324, in __init__
this = _mapscript.new_imageObj(*args)
MapServerError: imageObj(): Image handling error. imageObj() is severely broken and should not be used


The mapscript API suggests that mapscript.imageObj could be used normally. So I added the ubuntugis-unstable repository and updated python-mapscript to 6.4.0, but the error stays.

I didn't find anything usefull searching the internet for this error message, so I wonder whether imageObj is really broken or whether the error is caused by something else? I'm not busy with mapscript, I have to maintain the program where mapscript is part of. Can I use another function instead mapscript.imageObj which gives me back an image object?

The function where mapscript.imageObj(fname) is invocated is as follows:

def load_custom_symbols(self):
        lst_symbols = [ os.path.splitext(x) for x in
os.listdir(os.path.join(os.getcwd(), "_symbols")) ]

        for symbol, ext in lst_symbols:
            if ext == ".png":
fname = os.path.join(os.getcwd(), "_symbols", "".join([symbol, ext]))
                symbol = mapscript.symbolObj(symbol)
                img = mapscript.imageObj(fname)
                symbol.type = mapscript.MS_SYMBOL_PIXMAP
                symbol.setImage(img)
                self.map.symbolset.appendSymbol(symbol)

Thanks!
Tim
Hello,

in case anybody else is wondering about these problem when moving from 6.0.1. to 6.2.1:

After I learned that also labels where not working any more with 6.2. or 6.4:

eg:
class_layer = layer.getClass(i)
class_layer.label.type = mapscript.MS_TRUETYPE

caused:

  File "/usr/lib/python2.7/dist-packages/mapscript.py", line 841, in <lambda>
    __getattr__ = lambda self, name: _swig_getattr(self, classObj, name)
  File "/usr/lib/python2.7/dist-packages/mapscript.py", line 54, in 
_swig_getattr
    raise AttributeError(name)
AttributeError: label


I locked python-mapscript to the raring version (6.0.1) and since then 
everything is normal again: imageobj can be instantinated and labels are 
working as before





_______________________________________________
mapserver-users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/mapserver-users

_______________________________________________
mapserver-users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/mapserver-users

Reply via email to