Training, Open Source computer languages
PerlPHPPythonMySQLApache / TomcatTclRubyJavaC and C++LinuxCSS 
Search for:
Home Accessibility Courses Diary The Mouth Forum Resources Site Map About Us Contact
For 2021 - online Python 3 training - see ((here)).

Our plans were to retire in summer 2020 and see the world, but Coronavirus has lead us into a lot of lockdown programming in Python 3 and PHP 7.
We can now offer tailored online training - small groups, real tutors - works really well for groups of 4 to 14 delegates. Anywhere in the world; course language English.

Please ask about private 'maintenance' training for Python 2, Tcl, Perl, PHP, Lua, etc.
TCL question - accessing same-directory files

Posted by dvorak_user (dvorak_user), 8 February 2008
Once again, I barely managed to fit in that topic title!

For a while, I've tried to figure out how to access files in the same directory (in the context of multi-file programs), but I always get a "file does not exist" error unless the working directory is the same as the one that contains the files. Mainly, I would like to know how a script can either run scripts in its directory or obtain its absolute location.

Thanks for your time! This should be an easy one to figure out, but I just haven't had any luck.

Posted by admin (Graham Ellis), 8 February 2008
Add a "." to the appropriate path variable.   Tcl has a number of predefined variable s and if you lappend a "." for current directory before you read the file ...

% puts $tcl_libPath
/usr/lib/tcl8.4 /lib/tcl8.4 /usr/library /library /tcl8.4.7/library /System/Library/Frameworks/Tcl.framework/Versions/8.4/Resources/Scripts
% puts $auto_path
/System/Library/Frameworks/Tcl.framework/Versions/8.4/Resources/Scripts /System/Library/Frameworks/Tcl.framework/Versions/8.4/Resources /usr/lib ~/Library/Tcl /Library/Tcl /Network/Library/Tcl /System/Library/Tcl ~/Library/Frameworks /Library/Frameworks /Network/Library/Frameworks /System/Library/Frameworks
% put $tcl_pkgPath
/System/Library/Frameworks/Tcl.framework/Versions/8.4/Resources/Scripts ~/Library/Tcl /Library/Tcl /Network/Library/Tcl /System/Library/Tcl ~/Library/Frameworks /Library/Frameworks /Network/Library/Frameworks /System/Library/Frameworks

This page is a thread posted to the opentalk forum at and archived here for reference. To jump to the archive index please follow this link.

You can Add a comment or ranking to this page

© WELL HOUSE CONSULTANTS LTD., 2022: Well House Manor • 48 Spa Road • Melksham, Wiltshire • United Kingdom • SN12 7NY
PH: 01144 1225 708225 • FAX: 01144 1225 793803 • EMAIL: • WEB: • SKYPE: wellho