Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 3583aa1f46cbec038a49c35dc4c6af08edaf547009de462f1ee2faac0c058555
Ticket: 6fbabfe1661c22e7990bb917e9fa49cc16e016ea
Tkinter: Cannot find a usable init.tcl with recent core-9-0-branch
User & Date: apnadkarni on 2025-10-02 11:03:43
Changes

  1. icomment:
    > I have tried the changes from bug-6fbabfe166 and unfortunately the same error persists.
    
    Sorry, bit of a brain fade on my part. When you reported the value of `tcl_library` from `tclsh`, I registered it as the value in tkinter (which of course it could not be). So I assumed the issue was a missing search in the zipfs archive as opposed to mounting it in the first place. Fixed in the branch now if you would be so kind as to retry. I have tested it with the following program which I think distills the order in which tkinter initializes Tcl.
    
    ```
    #include <stdlib.h>
    #include "tcl.h"
    int main(int argc, char *argv[])
    {
       Tcl_Interp *ip;
       Tcl_FindExecutable(argv[0]);
       ip = Tcl_CreateInterp();
       if (Tcl_Init(ip)== TCL_ERROR) {
               printf("Tcl init failed: %s", Tcl_GetStringResult(ip));
               exit(1);
       }
       const char *libPath = Tcl_GetVar2(ip, "tcl_library", NULL, 0);
       printf("tcl_library=%s\n", libPath);
       return 0;
    }
    ```
    
    With the core-9-0-branch, the above gives the same error as you were seeing. With the bug-6fbabfe166 branch, Tcl seems to initialize successfully.
    
    Having said that, my preference would still be to replace the Tcl_FindExecutable call in tkinter with TclZipfs_AppHook if at all possible (would need more testing of course). It avoids a number of problems with initialization of encodings when the system encoding is not utf-8 and has to be loaded from disk. If that is not possible and mandating `--disable-zipfs` is not an option, I will further pursue the bug-6fbabfe166 branch to get it working (if it still fails for you).
    
    On a related note, I am also wondering about the `_get_tcl_lib_path(void)` function in tkinter. What is its role and will it affected by the tcl library being inside a zipfs archive and not visible to Python/tkinter?
    
  2. login: "apnadkarni"
  3. mimetype: "text/x-markdown"