comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » MESSAGE (used in VM) invokes DIALOG_MESSAGE: Can this be suppressed?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
MESSAGE (used in VM) invokes DIALOG_MESSAGE: Can this be suppressed? [message #88358] Wed, 16 April 2014 12:46 Go to next message
MarioIncandenza is currently offline  MarioIncandenza
Messages: 231
Registered: February 2005
Senior Member
Hello IDL wizards,

A quick search revealed that

> David Fanning said:
> Ugh, I *hate* MESSAGE

Clearly MESSAGE is a bad habit, but I used it for a long time, and so it's tough to weed out. The trouble is that when I run code interactively, which is most frequent, it works pretty much exactly how I want it to.

However, when the code is compiled and run non-interactively, the behavior of MESSAGE changes. Specifically, instead of printing to STDOUT or STDERR, it invokes DIALOG_MESSAGE. There is no acknowledgement in the IDL help of this behavior.

I can suppress this behavior, for code with no graphical output, by using 'unset DISPLAY' before running IDL. But that trick doesn't work for routines that make graphics.

Is there some other trick to get MESSAGE to behave? MESSAGE has lots of keyword options, but none appear to be related. Again, there is no acknowledgement in the help of the DIALOG_MESSAGE behavior.

--Edward H.
Re: MESSAGE (used in VM) invokes DIALOG_MESSAGE: Can this be suppressed? [message #88360 is a reply to message #88358] Wed, 16 April 2014 12:52 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Edward Hyer writes:

> A quick search revealed that
>
>> David Fanning said:
>> Ugh, I *hate* MESSAGE
>
> Clearly MESSAGE is a bad habit, but I used it for a long time, and so it's tough to weed out. The trouble is that when I run code interactively, which is most frequent, it works pretty much exactly how I want it to.

My goodness! I must have been having a bad day. I use MESSAGE all the
time! Love it! :-)

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: MESSAGE (used in VM) invokes DIALOG_MESSAGE: Can this be suppressed? [message #88361 is a reply to message #88360] Wed, 16 April 2014 13:09 Go to previous messageGo to next message
John Correira is currently offline  John Correira
Messages: 25
Registered: August 2011
Junior Member
On 04/16/2014 03:52 PM, David Fanning wrote:
> Edward Hyer writes:
>
>> A quick search revealed that
>>
>>> David Fanning said: Ugh, I *hate* MESSAGE
>>
>> Clearly MESSAGE is a bad habit, but I used it for a long time, and
>> so it's tough to weed out. The trouble is that when I run code
>> interactively, which is most frequent, it works pretty much exactly
>> how I want it to.
>
> My goodness! I must have been having a bad day. I use MESSAGE all
> the time! Love it! :-)
>
> Cheers,
>
> David
>

Yes, about 3.5 times per program :-)

~/idl/coyote $ grep -i 'message,' ~/idl/coyote/*.pro | wc -l
1294

~/idl/coyote $ ls -1 ~/idl/coyote/*.pro | wc -l
372
Re: MESSAGE (used in VM) invokes DIALOG_MESSAGE: Can this be suppressed? [message #88362 is a reply to message #88361] Wed, 16 April 2014 13:29 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
John Correira writes:

> Yes, about 3.5 times per program :-)
>
> ~/idl/coyote $ grep -i 'message,' ~/idl/coyote/*.pro | wc -l
> 1294
>
> ~/idl/coyote $ ls -1 ~/idl/coyote/*.pro | wc -l
> 372

A Haiku poem for you:

Daily newsgroup postings
reveal deep contradictions.
Coyote at work.

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.idlcoyote.com/
Sepore ma de ni thue. ("Perhaps thou speakest truth.")
Re: MESSAGE (used in VM) invokes DIALOG_MESSAGE: Can this be suppressed? [message #88365 is a reply to message #88358] Wed, 16 April 2014 16:41 Go to previous messageGo to next message
Michael Galloy is currently offline  Michael Galloy
Messages: 1114
Registered: April 2006
Senior Member
On 4/16/14, 1:46 PM, Edward Hyer wrote:
> Hello IDL wizards,
>
> A quick search revealed that
>
>> David Fanning said: Ugh, I *hate* MESSAGE
>
> Clearly MESSAGE is a bad habit, but I used it for a long time, and so
> it's tough to weed out. The trouble is that when I run code
> interactively, which is most frequent, it works pretty much exactly
> how I want it to.
>
> However, when the code is compiled and run non-interactively, the
> behavior of MESSAGE changes. Specifically, instead of printing to
> STDOUT or STDERR, it invokes DIALOG_MESSAGE. There is no
> acknowledgement in the IDL help of this behavior.
>
> I can suppress this behavior, for code with no graphical output, by
> using 'unset DISPLAY' before running IDL. But that trick doesn't work
> for routines that make graphics.
>
> Is there some other trick to get MESSAGE to behave? MESSAGE has lots
> of keyword options, but none appear to be related. Again, there is no
> acknowledgement in the help of the DIALOG_MESSAGE behavior.
>
> --Edward H.
>

I did not know this. Some investigation reveals that "message,
/informational" does just output to stdout, but without /INFORMATIONAL,
it goes to MESSAGE_DIALOG.

Although, I'm wondering why this matters to you, though? If you have
output from MESSAGE coming up, you have errors in your code. Surely, you
want to crash cleanly with an error message that you can see and fix
your bug, right?

Mike
--
Michael Galloy
www.michaelgalloy.com
Modern IDL: A Guide to IDL Programming (http://modernidl.idldev.com)
Research Mathematician
Tech-X Corporation
Re: MESSAGE (used in VM) invokes DIALOG_MESSAGE: Can this be suppressed? [message #88366 is a reply to message #88365] Wed, 16 April 2014 18:23 Go to previous messageGo to next message
MarioIncandenza is currently offline  MarioIncandenza
Messages: 231
Registered: February 2005
Senior Member
On Wednesday, April 16, 2014 4:41:19 PM UTC-7, Mike Galloy wrote:
> Although, I'm wondering why this matters to you, though? If you have
> output from MESSAGE coming up, you have errors in your code. Surely, you
> want to crash cleanly with an error message that you can see and fix
> your bug, right?

Yes. I want the program to halt, with an error message printed to STDERR, which I have directed into the output file, so that I can see the error message in context. What I do not want is a popup window that (by some magic) it is not even possible to copy/paste the error message off of, so you have to copy it by hand. I often have to hand off the code to other people to test, and the un-copyable error popup is very unhelpful.
Re: MESSAGE (used in VM) invokes DIALOG_MESSAGE: Can this be suppressed? [message #88376 is a reply to message #88366] Thu, 17 April 2014 13:23 Go to previous messageGo to next message
chris_torrence@NOSPAM is currently offline  chris_torrence@NOSPAM
Messages: 528
Registered: March 2007
Senior Member
On Wednesday, April 16, 2014 7:23:43 PM UTC-6, Edward Hyer wrote:

>
> Yes. I want the program to halt, with an error message printed to STDERR, which I have directed into the output file, so that I can see the error message in context. What I do not want is a popup window that (by some magic) it is not even possible to copy/paste the error message off of, so you have to copy it by hand. I often have to hand off the code to other people to test, and the un-copyable error popup is very unhelpful.

Which platform is this on? And how are you running it non-interactively?
-Chris
Re: MESSAGE (used in VM) invokes DIALOG_MESSAGE: Can this be suppressed? [message #88380 is a reply to message #88376] Thu, 17 April 2014 15:57 Go to previous messageGo to next message
MarioIncandenza is currently offline  MarioIncandenza
Messages: 231
Registered: February 2005
Senior Member
On Thursday, April 17, 2014 1:23:24 PM UTC-7, Chris Torrence wrote:
> Which platform is this on? And how are you running it non-interactively?

Linux. The DIALOG_MESSAGE behavior happens with either -rt or -vm.
Re: MESSAGE (used in VM) invokes DIALOG_MESSAGE: Can this be suppressed? [message #88391 is a reply to message #88380] Mon, 21 April 2014 12:05 Go to previous messageGo to next message
MarioIncandenza is currently offline  MarioIncandenza
Messages: 231
Registered: February 2005
Senior Member
On Thursday, April 17, 2014 3:57:37 PM UTC-7, Edward Hyer wrote:
> On Thursday, April 17, 2014 1:23:24 PM UTC-7, Chris Torrence wrote:
>
>> Which platform is this on? And how are you running it non-interactively?
>
>
>
> Linux. The DIALOG_MESSAGE behavior happens with either -rt or -vm.

If you're wondering why this matters: when the dialog with the message pops up, indicating a terminal error, the job does not end. The IDL job continues, including holding onto the license when run with -rt, until the "OK" button in the error dialog is manually clicked.
Re: MESSAGE (used in VM) invokes DIALOG_MESSAGE: Can this be suppressed? [message #88396 is a reply to message #88391] Mon, 21 April 2014 15:25 Go to previous messageGo to next message
chris_torrence@NOSPAM is currently offline  chris_torrence@NOSPAM
Messages: 528
Registered: March 2007
Senior Member
On Monday, April 21, 2014 1:05:57 PM UTC-6, Edward Hyer wrote:
> On Thursday, April 17, 2014 3:57:37 PM UTC-7, Edward Hyer wrote:
>
>> On Thursday, April 17, 2014 1:23:24 PM UTC-7, Chris Torrence wrote:
>
>>
>
>>> Which platform is this on? And how are you running it non-interactively?
>
>>
>
>>
>
>>
>
>> Linux. The DIALOG_MESSAGE behavior happens with either -rt or -vm.
>
>
>
> If you're wondering why this matters: when the dialog with the message pops up, indicating a terminal error, the job does not end. The IDL job continues, including holding onto the license when run with -rt, until the "OK" button in the error dialog is manually clicked.

Okay, I've tracked this down to "idlrtmain.sav", which controls "rt" and "vm" mode. Inside it has the following code block:

CATCH, Err
if(Err ne 0)then begin
catch, /cancel
error_msg = !error_state.msg

; on unix we may not have a display (an error condition
; in vm mode, not runtime mode) try to prevent an additional
; error about dialog_message when reporting the initial error.
; just check to see if the display is unset (an incomplete test)
; rather than using a DEVICE call (which would need another
; catch block).
if (!VERSION.OS_FAMILY eq 'unix' && $
strlen(getenv('DISPLAY')) eq 0) then begin
MESSAGE, error_msg
endif else begin
result = DIALOG_MESSAGE(error_msg)
endelse
return
endif

So, as you discovered, if your DISPLAY is not set then you are fine - the output will get directed to the terminal.

As a workaround, you can simply disable the DISPLAY environment variable from within IDL, and then re-enable it. Something like:

mydisp = GETENV('DISPLAY')
SETENV, 'DISPLAY='
MESSAGE, 'bad error'
SETENV, 'DISPLAY=' + mydisp

You could even put this into a catch block so all of your errors would funnel through it.

In the meantime, I'll take a look at modifying this code (or ripping it out) for IDL 8.3.1.

Cheers,
Chris
ExelisVIS
Re: MESSAGE (used in VM) invokes DIALOG_MESSAGE: Can this be suppressed? [message #88403 is a reply to message #88396] Tue, 22 April 2014 10:07 Go to previous messageGo to next message
MarioIncandenza is currently offline  MarioIncandenza
Messages: 231
Registered: February 2005
Senior Member
On Monday, April 21, 2014 3:25:59 PM UTC-7, Chris Torrence wrote:
> Okay, I've tracked this down

1) At this point, we should take a breath and think about what users might want. I expect that people developing pure GUI apps might rely on the DIALOG_MESSAGE() behavior. There just needs to be a way to suppress it.

2) A CATCH block might solve my immediate issue. Can I have a single CATCH block that will affect all of my subroutines, or do I need to copy the catch block into each subroutine?

Thanks for hunting this down!!

--Edward H.
Re: MESSAGE (used in VM) invokes DIALOG_MESSAGE: Can this be suppressed? [message #88404 is a reply to message #88403] Tue, 22 April 2014 10:44 Go to previous message
chris_torrence@NOSPAM is currently offline  chris_torrence@NOSPAM
Messages: 528
Registered: March 2007
Senior Member
On Tuesday, April 22, 2014 11:07:10 AM UTC-6, Edward Hyer wrote:
> On Monday, April 21, 2014 3:25:59 PM UTC-7, Chris Torrence wrote:
>
>> Okay, I've tracked this down
>
>
>
> 1) At this point, we should take a breath and think about what users might want. I expect that people developing pure GUI apps might rely on the DIALOG_MESSAGE() behavior. There just needs to be a way to suppress it.
>
>
>
> 2) A CATCH block might solve my immediate issue. Can I have a single CATCH block that will affect all of my subroutines, or do I need to copy the catch block into each subroutine?
>
>
>
> Thanks for hunting this down!!
>
>
>
> --Edward H.

Hi Edward,

You just need to have a catch block at the top-most level of your program. For example, if everything starts out in a single routine, then you can just put the single catch there (and make sure every subroutine has on_error,2). However, if you have a widget app with event handlers, then each event handler needs to have its own catch.

-Chris
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: traces plot outside of x-axis boundaries
Next Topic: Reading a Python numpy save (.npy) file into IDL

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 11:33:27 PDT 2025

Total time taken to generate the page: 0.00530 seconds