Menu

[6.75] "package require" is giving me errors and strange results

Help
Arralen
2024-10-03
2024-10-03
  • Arralen

    Arralen - 2024-10-03

    Mostly Iikely I'm just doing something st00pid, because I'm only a technical writer, not a real programmer, so I apologize in advance, but I am at a complete loss with this:

    I have that script that pretty much starts out with

    package require tcllib
    package require tklib
    package require tkTable
    

    and Freewrap 6.75 does notlike it - terminates with "script error: can't find package tcllib".
    That's both when I try to wrap or when I do the wishrun thing.

    If I change the first line to

    package require csv
    package require tklib
    package require tkTable
    

    it terminates with "script error: can't find package tklib", and presumably loads the CSV module just fine?
    But I can't load all modules seperatly ...

    Here's what it tells me on the console if I try that "by hand":

    (0.1) 1 % package require csv
    0.8.1
    (0.1) 2 % package require tcllib
    can't find package tcllib
    

    Here's an output from the freshly started console:

    (0.1) 1 % puts [info loaded]
    {{} winico} {{} Tktable} {{} sqlite} {{} twapi} {{} Twapi_wmi} {{} Twapi_winsta} {{} Twapi_ui} {{} Twapi_storage} {{} Twapi_shell} {{} Twapi_share} {{} Twapi_service} {{} Twapi_security} {{} Twapi_resource} {{} Twapi_registry} {{} Twapi_rds} {{} Twapi_process} {{} Twapi_pdh} {{} Twapi_os} {{} Twapi_nls} {{} Twapi_network} {{} Twapi_namedpipe} {{} Twapi_multimedia} {{} Twapi_mstask} {{} Twapi_input} {{} Twapi_eventlog} {{} Twapi_etw} {{} Twapi_device} {{} Twapi_crypto} {{} Twapi_console} {{} Twapi_com} {{} Twapi_clipboard} {{} Twapi_apputil} {{} Twapi_account} {{} dde} {{} registry} {{} Tk}
    (0.1) 2 %
    

    Looks to me it auto-loads Tktable? Yet, if I trim down my script to "package require tkTable", it does give me the error "can't find tkTable" ... oh, wait.

    Is this a problem with capitalisation? It's called "tkTable" in freeWrapDocs.pdf and on its manpage ... but with freewrap, only one spelling works:

    (0.1) 1 % package require tkTable
    can't find package tkTable
    (0.1) 2 % package require Tktable
    2.10
    

    No, can't get tcllib and tklib to work no matter what.
    At this point, I have no idea what to do ...

     
  • Ted Nolan

    Ted Nolan - 2024-10-03

    You don't require the whole library for either tcllib or tklib. You have to require individual packages.

    In general the info at https://core.tcl-lang.org/tcllib/doc/trunk/embedded/md/toc.md will give the "require" for a particular package.

     

    Last edit: Ted Nolan 2024-10-03
  • Arralen

    Arralen - 2024-10-03

    You don't require the whole library for either tcllib or tklib. You have to require individual packages.

    What? But it worked some time ago?!

    ... but as "package require tcllib" has been deprecated,
    you will need to pick one of the child packages ...
    

    Oh. That script is at least 10 years old ... . Sigh
    Thanks!

    btw., this does not explain the tkTable oddity, right?

     

    Last edit: Arralen 2024-10-03
  • Ted Nolan

    Ted Nolan - 2024-10-03

    I don't use Tk, so I don't know anything specific about Tktable, but the man page suggests that you do need

    "package require Tktable"

    https://wiki.tcl-lang.org/page/Tktable

     

Log in to post a comment.