For Programmers: Free Programming Magazines  


Home > Archive > Tcl > May 2004 > W2K (DOS) Environment









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author W2K (DOS) Environment
Afri

2004-05-23, 1:37 pm

Hi

I wrote a Tk (wish) program which I run from the DOS prompt. When I
submit it, I get the prompt back immediately and I cannot see
practically any error message, such as an unidentified variable. I
implemented bgerror to write to a log file but that did not help.
Any ideas?

Thanks
Victor Wagner

2004-05-23, 1:37 pm

Afri <amnon.friling@citicorp.com> wrote:
: I wrote a Tk (wish) program which I run from the DOS prompt. When I
: submit it, I get the prompt back immediately and I cannot see
: practically any error message, such as an unidentified variable. I
: implemented bgerror to write to a log file but that did not help.
: Any ideas?

Idea number 1: Use some better operationg system, which allows GUI
applications to write to stderr.

Idea number 2: don't start application from console propmpt, start wish
console or tkcon and source your startup file ther

Idea number 3: reopen stderr. Don't sure would it work inder Windows.

Idea number 4: execute your startup code (after redefining bgerror) as
after idle. bgerror handle only those errors which occur during event
processing.

--
#define NULL 0 /* silly thing is, we don't even use this */
-- Larry Wall in perl.c from the perl source code
Matti J. Karki

2004-05-23, 3:38 pm

Afri wrote:
> I wrote a Tk (wish) program which I run from the DOS prompt. When I
> submit it, I get the prompt back immediately and I cannot see
> practically any error message, such as an unidentified variable. I
> implemented bgerror to write to a log file but that did not help.
> Any ideas?


Hmm... [error "This is an error"] should bring up a dialog for the error
message.

For undefined variables etc. Wish should bring up a dialog box with
error message.

For stderr you can open a Wish console by calling [console show].
Everything written to stderr whould show up at the console window.

Hope that helps.

Sincerely,
Matti J. Kärki
Afri

2004-05-23, 7:32 pm

"Matti J. Karki" <mjk@iki.fi> wrote in message news:<c8qq95$df3$1@nyytiset.pp.htv.fi>...
> Afri wrote:
>
> Hmm... [error "This is an error"] should bring up a dialog for the error
> message.
>
> For undefined variables etc. Wish should bring up a dialog box with
> error message.
>
> For stderr you can open a Wish console by calling [console show].
> Everything written to stderr whould show up at the console window.
>
> Hope that helps.
>
> Sincerely,
> Matti J. Kärki


That worked quite well. I could see now an error which I did not see before.
THANKS!
Melissa Schrumpf

2004-05-23, 7:32 pm

Victor Wagner wrote:

> Afri <amnon.friling@citicorp.com> wrote:


> : I wrote a Tk (wish) program which I run from the DOS prompt. When I
> : submit it, I get the prompt back immediately and I cannot see
> : practically any error message, such as an unidentified variable. I
> : implemented bgerror to write to a log file but that did not help.
> : Any ideas?


<snips>

> Idea number 3: reopen stderr. Don't sure would it work inder Windows.


To the best of my knowledge, stock Win32 Wish.exe cannot do this. If one is
willing to muck about in the Wish source, Windows (non-console) applications
can, however, be made to attach to stdin/out/err using calls to AllocConsole()
and freopen(). See:

http://www.geocities.com/m_schrumpf...x.html#gsystray

for example code.

Note that doing this WILL result in a new ugly Windows cmd.exe box popping
open unless the calling application already has stdio channels open; that is,
unless you execute Wish.exe from an existing command prompt, or unless you
execute wish in a manner that grabs stdio channels, such as [open |wish.exe
w+].

--
MKS
ulis

2004-05-23, 9:35 pm

> [...] better operationg system, which allows GUI applications to write to stderr.

Not a good criteria for me. Interactive programs shouldn't need a console.

ulis
Donal K. Fellows

2004-05-24, 7:41 am

Afri wrote:
> I wrote a Tk (wish) program which I run from the DOS prompt. When I
> submit it, I get the prompt back immediately and I cannot see
> practically any error message, such as an unidentified variable. I
> implemented bgerror to write to a log file but that did not help.


If you're using Tcl/Tk 8.4, you can try making sure that you've put a
'package require Tk' line at the top of your program (that's good
programming style anyway) and then executing the program from the
console by typing 'tclsh yourProgram.tcl' instead of double-clicking on
the file or launching it using 'wish' (which is the same thing anyway
really).

Or you could use someone else's suggestion of adding 'console show' to
your script somewhere.

Donal.

Benjamin Riefenstahl

2004-05-24, 7:41 am

Hi Afri,

amnon.friling@citicorp.com (Afri) writes:
> I wrote a Tk (wish) program which I run from the DOS prompt. When I
> submit it, I get the prompt back immediately and I cannot see
> practically any error message, such as an unidentified variable.


Use tclsh84.exe instead of wish84.exe and add "package require Tk" to
the beginning of your script unless that statement is already there.

benny
Benjamin Riefenstahl

2004-05-24, 7:41 am

Hi Afri,

amnon.friling@citicorp.com (Afri) writes:
> I wrote a Tk (wish) program which I run from the DOS prompt. When I
> submit it, I get the prompt back immediately and I cannot see
> practically any error message, such as an unidentified variable.


Use tclsh84.exe instead of wish84.exe and add "package require Tk" to
the beginning of your script unless that statement is already there.

benny
Melissa Schrumpf

2004-05-24, 9:41 am

ulis wrote:

[color=darkred]
> Not a good criteria for me.


Indeed, choice of OS is often not a plausible 'out' by the time questions such
as this come up. Either it is dictated by management ('company standards'),
or other software requirements (e.g. Win32-only applications/
hardware&drivers). In any event, even if it were entirely up to the person
writing the program, by the time development has begun, switching OSen is an
inappropriate answer, short of a complete inability of the current OS to
perform the desired task, which is not the case this time.


> Interactive programs shouldn't need a console.



Not 'need.' I agree, GUI programs should not 'need' access to the console.
It's a matter of whether or not they ought to have easy access to it, if
desired. It's just design concept, really. It may be a good idea, for
example, to have stdout available to all GUI programs, for the purposes of
error event logging. But I believe Windows uses message passing or somesuch
for this purpose.

--
MKS
Afri

2004-05-24, 11:44 am

Benjamin Riefenstahl <Benjamin.Riefenstahl@epost.de> wrote in message news:<m3hdu6m99d.fsf@seneca.benny.turtle-trading.net>...
> Hi Afri,
>
> amnon.friling@citicorp.com (Afri) writes:
>
> Use tclsh84.exe instead of wish84.exe and add "package require Tk" to
> the beginning of your script unless that statement is already there.
>
> benny


I will definitely try this method.
Thanks!
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com