pythonactivetcl

Getting Python to use the ActiveTcl libraries


Is there any way to get Python to use my ActiveTcl installation instead of having to copy the ActiveTcl libraries into the Python/tcl directory?


Solution

  • Not familiar with ActiveTcl, but in general here is how to get a package/module to be loaded when that name already exists in the standard library:

    import sys
    dir_name="/usr/lib/mydir"
    sys.path.insert(0,dir_name)
    

    Substitute the value for dir_name with the path to the directory containing your package/module, and run the above code before anything is imported. This is often done through a 'sitecustomize.py' file so that it will take effect as soon as the interpreter starts up so you won't need to worry about import ordering.