setLayerLabel with text from macro not editable

Errors and unexpected results
Post Reply
User avatar
hproe
Posts: 504
Joined: Sat Nov 27, 2010 3:46 pm

setLayerLabel with text from macro not editable

Post by hproe »

Hi -
I am trying to write date/time information to the layer label in a jython module following the example in the User's Guide:

Code: Select all

layer.setLayerLabel(%timestamp%)
However, I cannot save the code, because I am given a syntax error. Executing the command directly in the shell produces AttributeError. On the other hand, writing an explicit text string is fine. Looks like version 1.6 has the same problem. Can you reproduce it?
HP
User avatar
bobc
Posts: 990
Joined: Mon Nov 15, 2010 5:57 pm

Re: setLayerLabel with text from macro not editable

Post by bobc »

Hi HP -

Macros (including timestamp) must be included as part of a string, meaning you need quotes around them. For example:

Code: Select all

layer.setLayerLabel('%timestamp%')

You can use macros in conjunction with other text strings, such as:

Code: Select all

layer.setLayerLabel('%timestamp% - GOES East image')

Please let me know if you have any questions about this.

Thanks -
Bob Carp
McIDAS Help Desk
Post Reply