MetaStack
MetaStack

Reputation: 3716

tcl can't find package even though file is in auto_path directory

on windows 7, tcl 8.6.4.

My repo.tcl and region.tcl files are both in c:\sites\vive

repo is a package:

package provide repo 1.0

namespace eval ::repo {}
namespace eval ::repo::create{}

proc ::repo::create {} {...} ...

region.tcl wants access to the procs in repo.tcl so it looks like this:

#source ./repo.tcl <---------old method, want to replace with package require
lappend auto_path [pwd] ;#<--puts c:\sites\vive in the autopath so package can find it.

package require repo 1.0 ;#<--tried this with out version number as well. same result.

::repo::create

...

I always get this error:

can't find package repo 1.0

Both of these sites have suggested I use the lappend auto_path https://unix.stackexchange.com/questions/44992/package-require-xxxx-tcl Can't find package BLT

What am I doing wrong? thanks!

Upvotes: 0

Views: 7461

Answers (1)

Dinesh
Dinesh

Reputation: 16436

You have to generate the pkgIndex.tcl file using pkg_mkIndex

% pkg_mkIndex -verbose [pwd] repo.tcl
successful sourcing of repo.tcl
packages provided were {repo 1.0}
processed repo.tcl
% lappend auto_path [pwd]
C:/Dinesh/Backup/cmder/vendor/msysgit/lib/tcl8.5 C:/Dinesh/Backup/cmder/vendor/msysgit/lib C:/Users/dsivaji/Desktop/delete
%
%
%
% package require repo
1.0

Have a look at the man page pkg_mkIndex for more information.

Upvotes: 2

Related Questions