Can't find package Tclx - tcl

When I run a tcl script in linux, the system return the error "can't find package Tclx"
I've checked the ActiveTcl-8.5/lib file, the Tcl8.5 exists.
Has anyone met it before? What can I do ?

Are you sure you are running ActiveState's tclsh?
tclsh is included in most Linux distributions, but TclX is not.
bll-tecra:bll$ which tclsh
/usr/bin/tclsh
bll-tecra:bll$ tclsh
% package require Tclx
can't find package Tclx
% exit
bll-tecra:bll$ /home/bll/ActiveTcl-8.5/bin/tclsh
% package require Tclx
8.4
% exit

execute the command, link your Tcl installation to the new repository - pick any shell in your Tcl installation
bash> teacup link make /path/to/new/repository /path/to/shell
install the package Tclx
bash> teacup install Tclx
check the environment from within your Tcl shell:
% package require Tclx

Related

Install Tcl tk binaries in Buildroot

I want to have tclsh binary in my root file system generated by Buildroot.
In buildroot, we can (from menuconfig) go to Interpreter languages and scripting -> then choose tcl
But this will install tcl8.6 packages (opt0.4, http1.0). The tcl shell itself is not implemented in the generated file system.
Does anyone know how to enable tclsh in Buildroot
Thanks in Advance
You will have to tell buildroot not to remove tclsh from your build. This can be achieved by setting BR2_PACKAGE_TCL_SHLIB_ONLY=n after having run make menuconfig.
See also https://git.busybox.net/buildroot/tree/package/tcl/tcl.mk#n51.

`mcu8051ide` on Linux mint 19 not working or opening

mcu8051ide on Linux mint 19 not working or opening, all dependencies are installed but when I check libraries, itcl is not present is the error.
I am confused what to do?
I installed Linux mint 19 in a virtual machine to check out what's going on.
The Itcl 3.4 pkgIndex.tcl file has the following contents:
# Tcl package index file, version 1.0
if {![package vsatisfies [package provide Tcl] 8.6]} {return}
package ifneeded Itcl 3.4 [list load [file join /usr lib x86_64-linux-gnu "libitcl3.4.so.1"] Itcl]
This means that Itcl will only be available with Tcl 8.6. However, mcu8051ide specifically starts tclsh8.5. That's the reason it can't find Itcl.
The mcu8051ide command is a very short shell script that only starts tclsh8.5 and passes /usr/share/mcu8051ide/lib/main.tcl as the script to run. If instead you run that script with tclsh (which is a symbolic link that points to tclsh8.6), it seems to work at first glance.
So, you can either modify the original startup script, or put a modified copy in your own bin directory.
go to /usr/local/share/mcu8051ide/lib
(or to /usr/share/mcu8051ide/lib depending on config during cmake)
and then edit the main.tcl file
using sudo nano main.tcl
On the 51st line,
change the value for MIN_TCL_VER from 8.5 to 8.6.

How do I find the path to the tclsh running my script?

From my Tcl script, I would like to find the path to the tclsh executable which is running my script (like sys.executable in Python), or at least find how the tclsh was invoked from the command line (like $^X in Perl)?
Just found it by myself: It's
info nameofexecutable

Missing "des" Tcl package

When i am trying to execute the following tcl code i got this
can't find package des
while executing
"package require des"
(file "encdec.tcl" line 1)
Tcl code
package require des
set key "12345678"; # Must be 8 bytes long
set msg "abcde"
##### ENCRYPTION
set encryptedMsg [DES::des -dir encrypt -key $key $msg]
# $encryptedMsg is a bunch of bytes; you'll want to send this around...
##### DECRYPTION
set decryptedMsg [DES::des -dir decrypt -key $key $encryptedMsg]
puts "I got '$decryptedMsg'"
how to get that package ?
This package is a part of "the standard Tcl library", tcllib.
If you're using a "batteries included" Tcl distribution, like ActiveTcl, you should use its means to get this package; for instance, with ActiveTcl, the command to install tcllib would be
teacup install tcllib
(you should run it in your Windows console prompt).
If you're using Tcl installed from a package of your operating system, tcllib is typically available in the form of a package as well. For instance, on a Debian (or its derivative) the command to install tcllib would be
apt-get install tcllib
Next time please tell us about your platform up front, without forcing anyone here to guess.

how to use spawn command in TCL

I am using the following code
#!/usr/bin/expect -f
#!usr/bin/expect
#package require Expect
puts "Hello world"
spawn ssh xyz#172.31.112.182
expect -nocase "password:"
send "abc123\r"
puts "done"
while executing, it throws error
Hello world
invalid command name "spawn"
while executing
"spawn ssh xyz#172.31.112.182"
(file "temp.tcl" line 9)
whats the wrong in my code
remove '#' before package require Expect.
The problem you've got is that while it is running in Tcl (I recognize that format of trace), the Expect package (which provides the spawn command) is absent for some reason. The first thing to do is to make the requirement for the Expect package explicit by uncommenting that package require line. That may be enough to fix your problem in itself, but if not it will complain about the package not being available. If it's not available, that means either that it just isn't installed, or that it's not being found. The former is... obvious to fix. :-) The latter is resolved by putting a line like this before that package require:
lappend auto_path /full/path/to/Expect/package/installation
Note that if you run the script with the expect program instead of the tclsh program, that package require will be done for you automatically. You're obviously not doing that…
Try running under tcl interpreter (!/usr/bin/tcl) and import Expect.
Did you installed Expect on your PC?
Please run the following command on your PC to check if Expect is available.
$which expect
/usr/bin/expect
sudo apt-get update -y
sudo apt-get install -y expect
which expect
Run the above commands respectively. If installed correctly, "which expect" will show "/usr/bin/expect" as an output. Run your script after installation,