From: shady_abdelwahed on
Hi All,

I'm using a solaris machine, and I do not have any root access or even
permissions to most of the paths that $auto_path points to. And, I
desperately need to require some packages. So, here what I did, and
please let me know where could have I been mistaken:

1- I downloaded the required tcl package in my home folder. Let's take
the "tcllib" as an example to use here.
2- When I run the installer.tcl file, it prompts a couple of default
paths that it will use for the installation which I do not have write
permissions to. So, if I say "No", I'm not ok with these defaults, the
installer halts. And, if I say "Yes", I get an error message because
of the permissions.
3- So, I changed the default paths in the installer.tcl file so that
when I run it, the package gets installed in my home folder.
4- I, then, ran the installer.tcl file again, and got a successful
installation (PS. I don't have an evidence that the installation is a
success other that the installer not prompting any errors to me on the
shell. So, I assume everything went alright)
5- In my tcl file, I lappend auto_path with my installation folder one
time, and followed by /lib another.
6- I, then, write package require tcllib.
7- type "tclsh mytclfile.tcl", and baaam... I get the usual error
message "can't find package tcllib while executing package require
tcllib"

I'm not sure what I should do. In my tcl file, I appended the
auto_path variable, then I package required the tcllib. And, I'm
pretty sure the auto_path was appended successfully.

Any help????


Thanks in advance.
From: Arjen Markus on
On 26 apr, 12:07, shady_abdelwahed <shady.abdelwa...(a)gmail.com> wrote:
> Hi All,
>
> I'm using a solaris machine, and I do not have any root access or even
> permissions to most of the paths that $auto_path points to. And, I
> desperately need to require some packages. So, here what I did, and
> please let me know where could have I been mistaken:
>
> 1- I downloaded the required tcl package in my home folder. Let's take
> the "tcllib" as an example to use here.
> 2- When I run the installer.tcl file, it prompts a couple of default
> paths that it will use for the installation which I do not have write
> permissions to. So, if I say "No", I'm not ok with these defaults, the
> installer halts. And, if I say "Yes", I get an error message because
> of the permissions.
> 3- So, I changed the default paths in the installer.tcl file so that
> when I run it, the package gets installed in my home folder.
> 4- I, then, ran the installer.tcl file again, and got a successful
> installation (PS. I don't have an evidence that the installation is a
> success other that the installer not prompting any errors to me on the
> shell. So, I assume everything went alright)
> 5- In my tcl file, I lappend auto_path with my installation folder one
> time, and followed by /lib another.
> 6- I, then, write package require tcllib.
> 7- type "tclsh mytclfile.tcl", and baaam... I get the usual error
> message "can't find package tcllib while executing package require
> tcllib"
>
> I'm not sure what I should do. In my tcl file, I appended the
> auto_path variable, then I package required the tcllib. And, I'm
> pretty sure the auto_path was appended successfully.
>
> Any help????
>
> Thanks in advance.

Tcllib is a collection of packages, it is not a package by itself.
Have you tried, say, "package require csv" - that is one of the
packages in Tcllib.

Regards,

Arjen
From: Larry W. Virden on
On Apr 26, 6:07 am, shady_abdelwahed <shady.abdelwa...(a)gmail.com>
wrote:

> 5- In my tcl file, I lappend auto_path with my installation folder one
> time, and followed by /lib another.

Besides using a specific tcllib package, as mentioned by Arjen Markus,
note that http://wiki.tcl.tk/auto_path recommends

set auto_path [linsert $auto_path 0 /home/mystuff/someextension/unix]

as the command to use to insert a path - of course, in this case, the
added path is being prepended rather than appended to the list
variable.

If you are appending a path, you might want to use

set auto_path [list $auto_path [file join ${ENV}(HOME) tcllib] ]

Using list should help ensure that auto_path stays a list.
From: Ralf Fassel on
* "Larry W. Virden" <lvirden(a)gmail.com>
| If you are appending a path, you might want to use
|
| set auto_path [list $auto_path [file join ${ENV}(HOME) tcllib] ]

This will turn 'auto_path' into a list with exactly two elements: the
first element the former auto_path list, the second element the new
directory -- not what you want here.

Use 'lappend' to append elements to auto_path

lappend auto_path [file join ${ENV}(HOME) tcllib]

R'
From: Larry W. Virden on
On Apr 26, 11:24 am, Ralf Fassel <ralf...(a)gmx.de> wrote:

>
> This will turn 'auto_path' into a list with exactly two elements: the
> first element the former auto_path list, the second element the new
> directory -- not what you want here.
>
> Use 'lappend' to append elements to auto_path
>
>    lappend auto_path [file join ${ENV}(HOME) tcllib]
>
> R'

Thank you so much for that. I've added your example to the wiki page.