0
votes

I'm encountering a frustrating problem right now with exec. All I'm trying to do is exec a tcl file from a program I've wrapped with TclApp, and I keep getting a "no such file or directory" error.

I've found this information here: https://community.activestate.com/faq/correctly-using-source-an and followed it to the dot, but to no avail. Here's some demo code:

Main file: I named the wrapped version TestClient.exe

package require Tk;

proc main {} {

set ::base [file dirname [info script]];
set file_to_exec [file join $::base "test.tcl"];
exec $file_to_exec;

}
main 

test.tcl:

tk_messageBox -type ok -message "It Works!";

This code will always come up with the error:

couldn't execute "C:\Dev\TestClient.exe\lib\application\test": no such file or directory

But the code works perfectly if I try source $file_to_exec; or any other variation of file access such as using the open command to read or write from the file. TclApp specifically cannot locate the file if I want to exec it. Any reason for that? And how can I get this to work? The program I have written is fairly large and it's based on being able to exec some tcl files which works when not wrapped. But now I go to wrap it and run into this issue;

Thanks in advance!

****UPDATE****

exec will work if I wrap my other tcl files with TclApp separately. For example, if I wrap test.tcl and make it Test.exe, I can run the TestClient.exe and exec Test.exe... this might be a solution to my problem. But it's still a peculiar problem.

1

1 Answers

1
votes

At least for me, .tcl files are not executable and so need to be executed in the shell... I need to do:

exec wish85.exe test.tcl