Opened 17 years ago
Closed 14 years ago
#2026 closed defect (wontfix)
mapObj.setSymbolSet fails if setExpression has been called previously on a classObj
Reported by: | Owned by: | hobu | |
---|---|---|---|
Priority: | high | Milestone: | 5.6 release |
Component: | MapScript-Python | Version: | 4.10 |
Severity: | normal | Keywords: | |
Cc: | sdlime |
Description (last modified by )
The following python script shows the problem, which is unrelated to the content of the symbolset file. Just comment-out the setExpression on the row before the last line and the script works nicely. import mapscript mapobj=mapscript.mapObj() outputFormat=mapscript.outputFormatObj("GD/PNG") outputFormat.name="png24" outputFormat.setMimetype("image/png") outputFormat.imagemode=1 outputFormat.setExtension("png") mapobj.legend.status=1 mapobj.legend.keysizex=100 mapobj.legend.keysizey=30 mapobj.legend.keyspacingy=20 mapobj.legend.width=100 mapobj.setSize(600,1200) mapobj.setExtent(132771,447652,134477,451064) mapobj.setOutputFormat(outputFormat) style=mapscript.styleObj() style.symbolname="point5" style.color=mapscript.colorObj(225,0,0) cls=mapscript.classObj() cls.insertStyle(style) cls.name="testclass" cls.setExpression("(4 + 4)") mapobj.setSymbolSet('test_symbols.set') This is the error: Traceback (most recent call last): File "test.py", line 23, in ? mapobj.setSymbolSet('test_symbols.set') File "/usr/lib/python2.4/site-packages/mapscript.py", line 1382, in setSymbolSet def setSymbolSet(*args): return _mapscript.mapObj_setSymbolSet(*args) _mapscript.MapServerError: loadSymbolSet(): Unknown identifier. Parsing error near ():(line 0)
Change History (8)
comment:1 by , 17 years ago
Cc: | added |
---|---|
Description: | modified (diff) |
Milestone: | → 5.0 release |
comment:2 by , 17 years ago
Steve,
loadExpressionString looks like it always returns 0 at the bottom of the function, which means MapScript is never going to throw an exception. Is this what we want? I assume this is because the evaluation of the expression is held off until render time, right?
follow-up: 4 comment:3 by , 17 years ago
All loadExpressionString does is set the stage for parsing. It doesn't (and can't) evaluate the validity of the expression until runtime. loadExpressionString is actually very lax about what is passed. If I recall, it looks for logical and regular expressions and if those don't match it just assumes a string expression. Basically it can't fail. An expression like (4+4) should evaluate to true all the time so would be legit, but useless. Try it in a mapfile to see.
Steve
comment:4 by , 17 years ago
Just for your information: if I move the call to setExpression after the call to setSymbolSet, the error goes away. Even if I call setExpression multiple times, nothing happens: it seems to me that setExpression leaves some sort of "state" around that setSymbolSet doesn't like.
I don't think that the expression itself is a problem.
Thanks, Fabio
follow-up: 6 comment:5 by , 17 years ago
I'm not convinced there's any sort of problem here. setExpression indeed sets up the an expression that is not used or verified until render time. I am not able to reproduce the complaint about setSymbolSet not being able to be opened if a call to setExpression is not there, however.
comment:6 by , 17 years ago
Well, non-deterministic behaviour is something I would call a bug: the symbolset file is right, otherwise mapserver would complain about it even without the setExpression method.
comment:7 by , 17 years ago
Milestone: | 5.0 release → 5.2 release |
---|
I can't replicate this. Pushing it ahead to 5.2 for now.
comment:8 by , 14 years ago
Resolution: | → wontfix |
---|---|
Status: | new → closed |
Closing WONTFIX since this could not be reproduced and has not been touched in over 2 years.
Two things:
1) Is (4+4) a valid expression? I thought we didn't allow math/operators except for simple things like string length.
2) MapServer 5.0 only exhibits the complaint about the symbolset
I think what was happening is setExpression was throwing an error but not returning NULL. The error sticks around until another error that *did* return NULL was made (the complaint about not finding the symbolset). If I'm not mistaken, this expression is now valid in 5.0, and MapScript properly throws the error for the missing symbolset. Declaring this one fixed and cc'ing Steve to see if he has any comment.