Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with exec in an exe-compiled tcl program

Status
Not open for further replies.

wisdoms

Technical User
Mar 13, 2013
4
DE
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: 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.
 
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
 
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.
 
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.
 
If I recall correctly, you have to explicitly include libraries that are not part of the core Tcl/Tk libraries.

_________________
Bob Rashkin
 
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?
 
I'm afraid I don't know.

_________________
Bob Rashkin
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top