f



"no such file or directory" when executing tcl file

Hi, new to TCL and hitting a road bump right out the gate. I just
installed ActiveTcl 8.5 on my Windows XP SP2 machine. I made the
following script and saved it as test.tcl:

#!/usr/local/bin/tclsh
puts stdout {Hello, Patrick!}

When in the TCL command prompt, I type test.tcl and it gives me the
error "couldn't execute ".\test.tcl": no such file or directory". I am
in the correct directory so I'm pretty lost as to why it is saying
this. Here are my exact steps:

<open command prompt>
H:\workspaces\tcl>tclsh85
% dir
 Volume in drive H is Data
 Volume Serial Number is 828C-6076

 Directory of H:\workspaces\tcl

01/12/2009  05:23 PM    <DIR>          .
01/12/2009  05:23 PM    <DIR>          ..
01/12/2009  05:37 PM                31 test.tcl
               1 File(s)             31 bytes
               2 Dir(s)  41,173,749,760 bytes free
% test.tcl
couldn't execute ".\test.tcl": no such file or directory

If someone could help fill in the blanks here, I'd appreciate it.
Apparently I'm overlooking something obvious. Thanks,

Patrick
0
patrickh (9)
1/12/2009 11:43:31 PM
comp.lang.tcl 23429 articles. 2 followers. Post Follow

2 Replies
1534 Views

Similar Articles

[PageSpeed] 43

On Jan 13, 12:43=A0am, "Patrick H." <patri...@gmail.com> wrote:
> Hi, new to TCL and hitting a road bump right out the gate. I just
> installed ActiveTcl 8.5 on my Windows XP SP2 machine. I made the
> following script and saved it as test.tcl:
>
> #!/usr/local/bin/tclsh
> puts stdout {Hello, Patrick!}
>
> When in the TCL command prompt, I type test.tcl and it gives me the
> error "couldn't execute ".\test.tcl": no such file or directory". I am
> in the correct directory so I'm pretty lost as to why it is saying
> this. Here are my exact steps:
>
> <open command prompt>
> H:\workspaces\tcl>tclsh85
> % dir
> =A0Volume in drive H is Data
> =A0Volume Serial Number is 828C-6076
>
> =A0Directory of H:\workspaces\tcl
>
> 01/12/2009 =A005:23 PM =A0 =A0<DIR> =A0 =A0 =A0 =A0 =A0.
> 01/12/2009 =A005:23 PM =A0 =A0<DIR> =A0 =A0 =A0 =A0 =A0..
> 01/12/2009 =A005:37 PM =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A031 test.tcl
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A01 File(s) =A0 =A0 =A0 =A0 =A0 =A0 31 bytes
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A02 Dir(s) =A041,173,749,760 bytes free
> % test.tcl
> couldn't execute ".\test.tcl": no such file or directory
>
> If someone could help fill in the blanks here, I'd appreciate it.
> Apparently I'm overlooking something obvious. Thanks,
>
> Patrick

To load a tcl script in tclsh use [source] so use

% source test.tcl

another option is to do:

tclsh test.tcl

The #! line will not do anything on windows, it's a unix-ism.

Mark
0
mpc.janssen (384)
1/13/2009 12:18:46 AM
On Jan 12, 6:18=A0pm, Mark Janssen <mpc.jans...@gmail.com> wrote:
> On Jan 13, 12:43=A0am, "Patrick H." <patri...@gmail.com> wrote:
>
>
>
> > Hi, new to TCL and hitting a road bump right out the gate. I just
> > installed ActiveTcl 8.5 on my Windows XP SP2 machine. I made the
> > following script and saved it as test.tcl:
>
> > #!/usr/local/bin/tclsh
> > puts stdout {Hello, Patrick!}
>
> > When in the TCL command prompt, I type test.tcl and it gives me the
> > error "couldn't execute ".\test.tcl": no such file or directory". I am
> > in the correct directory so I'm pretty lost as to why it is saying
> > this. Here are my exact steps:
>
> > <open command prompt>
> > H:\workspaces\tcl>tclsh85
> > % dir
> > =A0Volume in drive H is Data
> > =A0Volume Serial Number is 828C-6076
>
> > =A0Directory of H:\workspaces\tcl
>
> > 01/12/2009 =A005:23 PM =A0 =A0<DIR> =A0 =A0 =A0 =A0 =A0.
> > 01/12/2009 =A005:23 PM =A0 =A0<DIR> =A0 =A0 =A0 =A0 =A0..
> > 01/12/2009 =A005:37 PM =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A031 test.tcl
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A01 File(s) =A0 =A0 =A0 =A0 =A0 =A0 31 byt=
es
> > =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A02 Dir(s) =A041,173,749,760 bytes free
> > % test.tcl
> > couldn't execute ".\test.tcl": no such file or directory
>
> > If someone could help fill in the blanks here, I'd appreciate it.
> > Apparently I'm overlooking something obvious. Thanks,
>
> > Patrick
>
> To load a tcl script in tclsh use [source] so use
>
> % source test.tcl
>
> another option is to do:
>
> tclsh test.tcl
>
> The #! line will not do anything on windows, it's a unix-ism.
>
> Mark

Thanks for the fast reply mark, I appreciate it. That info is exactly
what I was looking for.

I've been using Perl for a bit, and that trained me to always include
the #! line in case the script is ever run on a unix machine - now I
do it out of habit.

Thanks again,

Patrick
0
patrickh (9)
1/13/2009 12:25:10 AM
Reply:

Similar Artilces:

Using "source" vs "package require" for Tcl application files
I would like to divide my Tcl application into separate files. Should I generally use "source" to combine the files, or should I use the package mechanism (package provide, package require, etc.)? What is the generally accepted practice? Thanks, Gregg On 30 dec, 01:04, GB <g...@invalid.invalid> wrote: > I would like to divide my Tcl application into separate files. Should I > generally use "source" to combine the files, or should I use the package > mechanism (package provide, package require, etc.)? > > What is the generally accepted practice? > > Thanks, > > Gregg IMHO use [source]. My reasoning: - The package mechanism is meant for getting access to general-purpose libraries, installed directly under the Tcl installation. - You talk of source files for your own application. So I would expect these files to reside in a directory containing that application. Then [source] is easier to use - and you guarantee that you get the source files from your application (otherwise a random package with the same name from the installation could interfer, if you are not careful with the library path) - Using [source] also makes it clear that these files are meant for your application only, not for more general purposes. Regards, Arjen Arjen Markus wrote: > On 30 dec, 01:04, GB <g...@invalid.invalid> wrote: >> I would like to divide my Tcl application into separate files. Should I >> gen...

error: "couldn't execute "date": no such file or directory" in Tk
hi, i am using the following code in a tcl script with the TK framework, and i get the above error on executing the file main file.. main file --------------- #!c:/tcl/bin/tclsh label .l -text "click to execute" button .b -text "Execute" -command "exec_script" proc exec_script {} { set inp 1 source sss.tcl puts $inp } pack .l .b sss.tcl ----------------------------- #!c:/tcl/bin/tclsh set inp 0 puts $inp set d [exec date] The error i get is "couldn't execute "date": no such file or directory" I am using Tk with Tcl and it is necessary to print the date along with along with my output. The "exec date" works perfect in a tcl script only. but when i use it along with TK i get the error... i will be glad if someone could please help me... thank you.. On 21 Feb., 12:42, "ronnie" <maninder....@gmail.com> wrote: > set d [exec date] > > The error i get is "couldn't execute "date": no such file or > directory" Since Tcl 7.6 or so, the [clock] function delivers date and time in a portable way. See http://www.tcl.tk/man/tcl8.4/TclCmd/clock.htm Examples: 53615 % clock format [clock seconds] Wed Feb 21 12:48:09 W. Europe Standard Time 2007 84 % clock format [clock seconds] -format %c Mittwoch, 21. Februar 2007 12:48:21 53 % clock format [clock seconds] -format %Y-%m-%d,%H:%M:%S 2007-02-21,12:49:42 That [exec date] does work at times, and not at ...

problem with "file executable" on windows, tcl 8.5.2
ActiveState TCL 8.5.2, Windows XP SP2 'file executable' always returns 0, even on .exe and .bat when asked for a file on a network share: % info patchlevel 8.5.2 % set file L:/ralf/si++aegis/si++.4.0.C443/bin/winnt/gen.exe L:/ralf/si++aegis/si++.4.0.C443/bin/winnt/gen.exe % file exists $file 1 % file readable $file 1 % file executable $file 0 % file executable {L:/ralf/si++aegis/si++.4.0.C443/bin/winnt/simenu.bat} 0 However, when copying the files to local disk, the files are qualified as executable: % cp L:/ralf/si++aegis/si++.4.0.C443/bin/winnt/simenu.bat d:/temp % file executable d:/temp/simenu.bat 1 % cp L:/ralf/si++aegis/si++.4.0.C443/bin/winnt/gen.exe d:/temp % file executable d:/temp/gen.exe 1 Also: % set argv0 D:/Programme/tcl/bin/tclsh85.exe % file executable $argv0 1 The L:/ Network Share is an Samba share mounted from a linux box. Are there any special requirements for the smb options? Thanks R' Ralf Fassel said on 24/04/2008 21:21: > ActiveState TCL 8.5.2, Windows XP SP2 > > 'file executable' always returns 0, even on .exe and .bat when asked > for a file on a network share: > The L:/ Network Share is an Samba share mounted from a linux box. I have opened a similar report some time ago for file readable on a Samba share. Still open. See: http://sourceforge.net/tracker/index.php?func=detail&aid=1613456&group_id=10894&...

How to convert a ".p" file to ".m" file
I got a algorithm package. But the matlab file is in p-file. How can I convert these file to m-file so that I can read the source code of the algorithm. Does anyone can help me thanks tinyloop wrote: > > > I got a algorithm package. But the matlab file is in p-file. How > can > I convert these file to m-file so that I can read the source code > of > the algorithm. > Does anyone can help me > thanks Cannot be done and should not be tried / per tinyloop <fcen@ee.cuhk.edu.hk> wrote: > I got a algorithm package. But the matlab file is in p-file. How > can...

is there definition of "binary file" or "text file"
even so called "text file", acturally it's also stored in the binary format. niy38@hotmail.com (Niy) writes: > even so called "text file", acturally it's also stored in > the binary format. There isn't a difference on unix. Unix sees a file as simply a sequence of bytes, which it does not try to interpret. Interpretation of file formats is done at the application level. For example, a database program would expect a certain format, a text editor another format, but the standard I/O routines just deal with streams of bytes. What's the issue you...

Re: CONVERTING a ".sas" file into ".dat" file
hi ... just one suggestion (addition) to the code put _all_; writes values preceded by the variable names, plus the SAS automatic variables data _null_; set sashelp.class (obs=2); put _all_; run; Name=Alfred Sex=M Age=14 Height=69 Weight=112.5 _ERROR_=0 _N_=1 Name=Alice Sex=F Age=13 Height=56.5 Weight=84 _ERROR_=0 _N_=2 make one addition ... data _null_; set sashelp.class (obs=2); put (_all_) (:); run; Alfred M 14.0 69.0 112.5 Alice F 13.0 56.5 84.0 and another idea ... if you want the data aligned in columns ... data _null_; set sashelp.class (obs=2); pu...

Problem with "Skip file types" in "Find Files".
I would like to search for text files based on some texts. And I want to exclude svn file (i.e. *.svn-base). So I add the extension .svn-base in "Skip file types" and expect Matlab "Find Files" GUI to skip the svn files. However, "Find Files" still returns the svn file. I think "Find Files" has problem with this kind of filename, eg. "abc.c.svn-base". Is it treating "c.svn-base" as extension? However, I try out the Matlab function FILEPARTS and it works fine. >> [pathstr, name, ext, versn] = fileparts('abc.c.svn-base') ...

why construct file with "", the path of the file return "/"? 364127
l am a little puzzled, why the file's behavior like this: File fl = new File("","1.txt"); System.out.println(fl.getName()); System.out.println(fl.getParent()); System.out.println(fl.getPath()); System.out.println(fl.getAbsolutePath()); try { System.out.println(fl.getCanonicalPath()); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } ...

Re: software "file.txt" to "file.dat"
On 1/1/05 at 2:33 AM, malo@mncn.csic.es (Aurelio F Malo) wrote: >I' d like to ask you if there is a way to transform a "file.txt" >into a "file.dat" format. I am certain there is. But I cannot provide details until you specify the format details of each file. For example, you could have "file.txt" formatted as: a single numeric record per line multiple mixed records per line with records separated by tabs, spaces, commas etc Mathematica Lists The point is neither the extension .txt nor the extension .dat are sufficient to specify the fo...

What is a "File URL" as opposed to a "non-file URL"
Hi, Sorry to be thick, but what is a "File URL"? Looking on the web, the closest I got to it was a URL that literally starts with "File:"; is that correct? The reason I ask is that I'm looking at IE Java security settings in my IE browser and it says that "Connect to non-file url codebase" is OK but "File Based" is disabled. As I hope to have the flexibility to use a subset of FTP as the protocol to upload my Applets from VMS I am hoping that "File Based" does mean "file:" and does not pertain to FTP vs HTTP. Does it just mean &...

How to redirect "out" and "o" files to another directory?
Hi folks, when i compile my code in tornado , i am getting "o" and "out" files ( say within "/PPC604gnu/"). I want to copy "out" files automatically to some other directory after compilation of my code. If possible where i have to change ? ..Raja In your Tornado project, under properties of the build, look for the MACRO called POST_BUILD_RULE. Put in a line to copy the files. The make file will run that line in the shell after the build completes. LC ...

now do you "link" .tcl files?
Hello, I am trying to accomplish the most basic form of "linking" files, with Tcl, and I am having difficulty. I have 2 .tcl files in the same dir: lib.tcl and prog.tcl, and I want to define a proc in lib.tcl, but use it in prog.tcl. What is the right way to do this? I did manage to accomplish this, by doing source lib.tcl in prog.tcl The problem with this approach, is that depending on where I call tclsh from, I have to change the above line. For example, if I call it from a subdirectory, I have to do: source ..\\prog.tcl So this is certainly not the right way to do linking. In the simplest case of linking, the lib.tcl and prog.tcl are in the same directory, then there should be a way to link them no matter where tclsh is called from. How? (I did RTFM carefully but I can't seem to find this) Mark Mark Mark_Galeck wrote: > Hello, I am trying to accomplish the most basic form of "linking" > files, with Tcl, and I am having difficulty. I have 2 .tcl files in > the same dir: lib.tcl and prog.tcl, and I want to define a proc in > lib.tcl, but use it in prog.tcl. What is the right way to do this? > > I did manage to accomplish this, by doing > > source lib.tcl > > in prog.tcl > > > The problem with this approach, is that depending on where I call > tclsh from, I have to change the above line. For example, if I call > it from a subdirectory, I have to do: > > source ..\\prog.tcl &...

Fast alternatives to "File" and "IO" for large numbers of files ?
People, I have script that does: - statistical processing from data in 50x32x20 (32,000) large input files - writes a small text file (22 lines with one or more columns of numbers) for each input file - read all small files back in again for final processing. Profiling shows that IO is taking up more than 60% of the time - short of making fewer, larger files for the data (which is inconvenient for random viewing/ processing of individual results) are there other alternatives to using the "File" and "IO" classes that would be faster? Thanks, Phil. ...

File.new("file.ext", "w").write data
Consider... File.new("file.ext", "w").write data Is this safe? When will the file be closed? For IO it's said: "I/O streams are automatically closed when they are claimed by the garbage collector." Is this true for files as well, (File is a subclass of IO)? I know you can do... File.open("file.ext", "w"){|f| f.write data} ...., but the first one is shorter and better readable. gegroet, Erik V. Erik, The file handle will indeed stay open until the File instance is GC'd. The block-passing version is a few extra characters, but...

Short file format: "Progra~1" for "Program Files"
Hello all, From my Windows command prompt, I'm trying to run an .exe which requires an argument for CLASSPATH, along the lines, <%> Foo.exe -CLASSPATH="C:\Program Files\AppFolder\a.jar....." When the length of CLASSPATH's value is quite large, the .exe doesnt work the way it should. To truncate the CLASSPATH length I tried "C:\Progra~1" for "C:\Program Files". It seems to work fine. This exe needs to run on the end-user's PC. My question is, how reliable is it to use "Progra~1" for "Program Files". If the end-user installs some software which changes "Program Files" from Progra~1 to Progra~2, would I run into trouble. Has anyone run into this situation before? Thanks for your time, Prabh Prabh wrote: > This exe needs to run on the end-user's PC. > My question is, how reliable is it to use "Progra~1" for "Program > Files". Not at all. > If the end-user installs some software which changes "Program Files" > from Progra~1 to Progra~2, would I run into trouble. Yes. In fact, hard-coding C:\Program Files is wrong. > Has anyone run into this situation before? Yes, though I've not needed to use a short file name in a long time. You should call SHGetFolderPath or similar, followed by GetShortPathName. Note that a file or directory might not have a short name, in which case you're probably stuck. ...

can the command "dir" display the "file verison" of a file?
I would like to use DOS command to display the "file verison" of a file, and I have checked with the "help", it seems "dir" does not have this parameter. Can someone help me? Thanks a lot <mander.lala@gmail.com> wrote: >I would like to use DOS command to display the "file verison" of a > file, and I have checked with the "help", it seems "dir" does not have > this parameter. What "file version" is that? DOS-files doesn't have any such thing. If you mean the build-version in a PE/Win execu...

files "." and ".." from readdir()
Will readdir always return "." and ".." as the _first_ two entries returned if the filesystem has them? I'm just curious if it testing for them can be skipped after the first two have been tested. I've always written my loops around readdir with the tests applied in every case. -- |WARNING: Due to extreme spam, googlegroups.com is blocked. Due to ignorance | | by the abuse department, bellsouth.net is blocked. If you post to | | Usenet from these places, find another Usenet provider ASAP. | | Phil Howard KA9WGN (email for humans: first ...

Re: File specification and "file" statement"
You had better do a %put of the exact, entire line that you are attempting to generate. I'm better that you macro variables contain some embedded blanks, quotes, or other special characters that are tripping you up. Also, are two consecutive slashes legal in a *nix path specification? Anyway, add this right before your data step and see what it prints: %put file "/export/samfs-bcf/rcf-12/mkhan//Create_account_&uscid..&rundate..txt"; ----- Original Message ----- From: "sasdummies" <khanatusc@GMAIL.COM> To: <SAS-L@LISTSERV.UGA.EDU> Sent: Monday, O...

function "strftime" produce "No such file or directory" error
Hello, everyone. This is a test program that generates undesired results when cross compiling with eldk-4.0. It is strange that localtime_r sets errno to ENOENT at the first time, but never again in the following calls, while strftime always sets errno to ENOENT. But errno will never be set if run on Ubuntu 12.04.4, or Debian 7. Can someone help me? This is the output: # ./test_timegen 1st errno = 0, Success 2nd errno = 2, No such file or directory 3rd errno = 2, No such file or directory 2000-01-05 04:12:11.661426 1st errno = 0, Success 2nd errno = 0, Success 3rd errno = ...

make "File name" default when searching in an "open file" dialogue ?
With Snow Leopard, I have noticed that if, in a file selection dialogue, I want to use the search feature, as I start typing in the search box, the dialogue changes to a search dialogue with a default set to "contents". Anyone know if there is a way to have it default to "File name" ? I find it annoying to have to switch from typing, move mouse to click on the "file name" button, then click back into the input field to finish the seach term. I know this isn't a major issue, but if there were a way to get it to use "file name" by default...

problem on startup: File error: "Cannot open load file", "xfonts"
Hi everybody I just installed the newest emacs testing as emacs package. after starting it with emacs --debug-init I get the error Debugger entered--Lisp error: (file-error "Cannot open load file" "xfonts") require(xfonts) byte-code("��!������@��!��!A��B\"� B��B\"�@��B\"A@*�A�B��!�C���\"��!�FBF��!���\"��!��!I�VH�V��!��!�K%N�!!R�#\"\"\"\"\"S\"!!�\"!!\"!\" �=��Q �=����# �=��Q��\n� � !� ! �\f!\f�\f \"��\f #� a.s.o. The require(xfonts) is in the .gnu-e...

Undefined error #612
I got this message when i did a nonlinear regression. I am using SPSS 13.0 Undefined error #612 - Cannot open text file "C:\Program Files\SPSS\en\windows\spss.err": No such file or directory=AC Predicted values are missing, or case weights are missing or not positive for all cases. This command is not executed. What is wrong with the SPSS? I have no problem at all when i use version 12.0 Thank you, run - I have not seen anyone respond to this one - Here is a comment, even though it is not very useful. On 22 Mar 2005 18:56:27 -0800, "run" <run@hawaii.edu> wrote: > > I got this message when i did a nonlinear regression. I am using SPSS > 13.0 > > Undefined error #612 - Cannot open text file "C:\Program > Files\SPSS\en\windows\spss.err": No such file or directory� 1) That's a funny character at the end of 'directory', which reads as "=AC" or else as a special character. 2) That text file message seems to point to a message-file that should be there at installation; so it *seems* to signify that the installation went wrong, or disk contents have been altered since the time of installation. Combining those two things with my long experience at pondering error messages -- I wonder whether SPSS could be totally screwed up at this stage, so that the next line about "Predicted values ... weights" may have little to do with anythi...

redirect output of "source a.tcl" to a file
I need to redirect output of TCL commands to a file. I have been able to do it by redirecting the command output using ">". Now I am stuck at source command as it gives me the error % source a.tcl > a.txt wrong # args: should be "source fileName" % How can I run source command and store its output in a file? -- San san <sandeep.gond@gmail.com> wrote: > I need to redirect output of TCL commands to a file. I have been able > to do it by redirecting the command output using ">". Now I am stuck > at source command as it gives me the error > % source a.tcl > a.txt > wrong # args: should be "source fileName" > % > How can I run source command and store its output in a file? Depends on how the "output" is generated inside the script: if it's just the returnvalue of the last command in it, then: set fd [open a.txt w]; puts $fd [source a.tcl]; close $fd if the a.tcl contains "puts" to stdout/stderr, you may replace the "puts" command to do something else. if the a.tcl contains calls to external programs that write directly to stdout/stderr, you'll have to reopen those channels first, but this effect will then remain even after the sourcing. source a.tcl does execute the commands in a.tcl within the same instance of tclsh as where you called "source" from. If you don't want any effects from a.tcl to remain in the curr...

file open "no such file"
I am getting this error when I try to run the code below **************** f = open("~/m", "r") print f.read() **************** **************** :~$ python python/my.py Traceback (most recent call last): File "python/my.py", line 1, in ? f = open("~/m", "r") IOError: [Errno 2] No such file or directory: '~/m' **************** but I have the "m" file in my home/username/ thank you Gary Wessle wrote: > I am getting this error when I try to run the code below > > **************** > f = open("~/m"...

Web resources about - "no such file or directory" when executing tcl file - comp.lang.tcl

Resources last updated: 3/13/2016 12:02:58 PM