Opened 20 years ago

Closed 20 years ago

#519 closed defect (fixed)

msAddImageSymbol should not raise error in the context of an embedded scalebar

Reported by: sgillies@… Owned by: sdlime
Priority: high Milestone: 4.2 release
Component: MapServer C Library Version: 4.0
Severity: normal Keywords:
Cc:

Description

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?

Change History (2)

comment:1 by dmorissette, 20 years ago

Cc: morissette@… added
Milestone: 4.2 release
Summary: msAddImageSymbol should not raise error in the context of an embedded scalebar msAddImageSymbol should not raise error in the context of an embedded scalebar
I believe this should have been fixed when I worked on bug 612 earlier today.
Can you please test this again Sean?

comment:2 by sgillies@…, 20 years ago

Resolution: fixed
Status: newclosed
Daniel, sorry I let this one go so long!  I have confirmed that the
bug is fixed.

Note: See TracTickets for help on using tickets.