3

I wrote the following code as a wrapper around messages pushed during the running of the script. Using Python IDLE this works fine, but in Eclipse I get the following output:

def ESRIP(gp,message):
    """Prints messages into ArcGIS Script window"""
    message = str(message)
    gp.AddMessage(message)
    return message    

print ESRIP(gp, "processing one million points")

Any thoughts on how I can remove the weird text?

2
  • 2
    I suggest changing the title of the question to "Geoprocessor AddMessage issue in Eclipse" for a bit more description.
    – om_henners
    Commented Aug 5, 2010 at 2:01
  • I can't seem to figure out how to change the title, I will be clearer in the future
    – GuidoS
    Commented Aug 5, 2010 at 14:20

1 Answer 1

4

I've had the same issue. In those cases where it was really a problem, I just added a print for the message, and commented out the gp.AddMessage while I was testing in Eclipse, then uncommented it when moving it into ArcGIS.

Interestingly the gp.AddMessage works fine when run from the Python command line. Not sure where the extra characters are coming from (maybe AddMessage returns an unescaped string or something). I suspect it comes down to each interface's way of handeling unknown characters - command promt ignores them, IDLE doesn't print the string, and Eclipse tries to print the unknown characters.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.