INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Problem with exec in an exe-compiled tcl program

Problem with exec in an exe-compiled tcl program

Problem with exec in an exe-compiled tcl program

(OP)
Hi all,

my tcl/tk program works fine, as long as program.tcl file is launched.
BUT, if I compile it to .exe (as described here: http://wiki.tcl.tk/11861) and I launch program.exe file, exec commands - like the following - don't work anymore:

set out [catch { exec "./collectfiles.bat" -ne $ip -dir -outDir "$Glob(out_dir)" -timeout 100 >> "$Glob(out_dir)/$ip.log" & } err]

I suspect a different behavior of stdout in program.exe. Is it possible?
Has anybody of you had any similar experience after compiling an exe file?

Thanks in advance.

RE: Problem with exec in an exe-compiled tcl program

First of all, I never used Tclkit. When I did wrap Tcl scripts I used Freewrap but I've long since ditched windows for Linux. Anyway, since no one else seems to be taking the bait, I'll bite.

First of all if Tclkit works like Freewrap, it doesn't compile Tcl code, it wraps it. That is, the script is bundled into to an executable along with the Tcl interpreter. That's why the result is so huge. As such, paths are a little peculiar since the program is running in it's own little world. What I suspect is happening is that you didn't bundle the auxiliary data correctly, like "collectfiles.bat". You should check the instructions for the wrapper you used to make sure your bundle includes all the data, regardless of whether you think it should be on the target platform.

_________________
Bob Rashkin

RE: Problem with exec in an exe-compiled tcl program

(OP)
Hi Bong,

thanks for your reply. Paths are correct, I've double-checked them.
I’ve played a bit and I’ve found a possible workaround.
Since Tk does not provide real standard IO capabilities, a command like this:

exec <bat file> <args>

fails, if launched by .exe file (this is what I#ve noticed).
Thus I’ve outsourced only those critical commands as follows:

exec tclsh out-script.tcl <args>

whereas I’ve nested my bat file in out-script.tcl.
Don't ask me why but it works.

RE: Problem with exec in an exe-compiled tcl program

(OP)
Hi Bob,

I'm using now Freewrap, but...
if I launch my my_gui.tcl GUI, "package require Img" is found and used, no error at all.
After wrapping it to exe with Freewrap, I got:

Error sourcing /Temp/my_gui.tcl: can't find package Img

Why does it happen? I'm not an expert of libraries, but somehow it cannot be found.

RE: Problem with exec in an exe-compiled tcl program

If I recall correctly, you have to explicitly include libraries that are not part of the core Tcl/Tk libraries.

_________________
Bob Rashkin

RE: Problem with exec in an exe-compiled tcl program

(OP)
The script works so:

set Glob(Tk) [package require Tk]
set Glob(Tk:Img) [package require img::png]

if launched via my_gui.tcl, whereas Tk v8.5.11.
But when Freewrap.exe wraps it, Tk becomes 8.5.9 and:

Error sourcing /Temp/TechLog_Fetcher/techlog_fetcher.tcl: can't find package img::png

How can I recall such img::png library also for Tk v8.5.9?

RE: Problem with exec in an exe-compiled tcl program

I'm afraid I don't know.

_________________
Bob Rashkin

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close