Ticket #519 (closed defect: fixed)
msAddImageSymbol should not raise error in the context of an embedded scalebar
|Reported by:||sgillies@…||Owned by:||sdlime|
|Component:||MapServer C Library||Version:||4.0|
I ran into this while trying to embed a scalebar using Python MapScript. >>> imgobj = mapobj.draw()Traceback (most recent call last): File "<stdin>", line 1, in ? File "/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/mapscript.py", line 1834, in draw def draw(*args): return apply(_mapscript.mapObj_draw,args) IOError: msAddImageSymbol(): Unable to access file. Error opening image file /Users/sean/Consulting/Clients/RealGo/2003_001/lqms/maps/scalebar. As far as I can tell, msAddImageSymbol will _always_ throw an error when called in the embedded scalebar context. No error should be thrown when executing a perfectly normal use case. And I have demonstrated that a scalebar will be embedded despite the error throw. A work-around is something like this: imgobj = None try: imgobj = mapobj.draw() # an embedded scalebar is defined except IOError: pass # because scalebar is embedded _despite_ the error! I propose that the error throw be eliminated from msAddImageSymbol. Since the function doesn't return MS_FAILURE when the error is thrown, it seems to be more of a warning than an error. Does MapServer need a warning stack?
Note: See TracTickets for help on using tickets.