Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8016533
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T20:33:51+00:00 2026-06-04T20:33:51+00:00

In tcl how does one find out the path of the package loaded? %

  • 0

In tcl how does one find out the path of the package loaded?

% tclsh
% package require csv

I want to find out the path from which csv was loaded.

In python, one can find the path of a module using

>>> import os
>>> print os.__file__
'/a/b/python2.2.1/linux26_x86_64/lib/python2.2/os.pyc'

I am looking for a similar command in tcl

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T20:33:52+00:00Added an answer on June 4, 2026 at 8:33 pm

    It’s not that simple: a package in Tcl appears to be a more abstract thing than that in Python.

    First, there are two kinds of packages: “classic” and “modules” which have different underlying mechanisms for finding what to load in response to the package require ... command.

    Next, both kinds of packages are able to do whatever they wish to provide their functionality. It means they can be (but not limited to):

    • Pure Tcl packages, source‘ing just one Tcl file or any number of files.
    • Packages implemented in C or another compiled language, which are in the form of dynamic library which gets loaded when the package is required.
    • A combination of the above, when there’s a C library and a layer of Tcl code around it (usually providing helper/convenience commands).

    Hence the question per se has little sense as only modules are represented by exactly one self-contained file but “classic” packages are free to implement themselves as they see fit.

    On the other hand, each package normally provides (using one way or another) certain information to the package subsystem which can be retreived (and parsed) using the package ifneeded command. For instance, on my Windows system with ActiveState Tcl 8.5.x, I have:

    % package require csv
    0.7.2
    % package ifneeded csv 0.7.2
    package provide csv 0.7.2;source -encoding utf-8 {C:/Program Files/Tcl/lib/teapot/package/tcl/teapot/tcl8/8.3/csv-0.7.2.tm}
    

    Note that what package ifneeded returns is just a Tcl script which is meant to be evaluated to get the package loaded, so parsing of this information is bound to be inherently ad-hoc and fragile.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm getting a user defined signal 2 error from the tcl interpreter. What does
Here is a demo sample of TCL code for iwidgets::scrolledtext . package require Iwidgets
Does python have an equivalent to Tcl's uplevel command? For those who don't know,
I have a flat Tcl list. Now I want to append a new element
Is there any Tcl podcasts (in English)? It's not hard to find about Ruby,
The Tcl expr function supports arguments written in hex notation: operands which begin with
Does anyone know what files are required for MySql to work with a Tcl
I've made a servlet which uses the org.apache.commons.fileupload api to upload a CSV file
I have run into a problem in one of my Tcl scripts where I
I want to transform the following c code to TCL. int a[10],b[10]; int n=20

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.