We're back after a server migration that caused effbot.org to fall over a bit harder than expected. Expect some glitches.

Importing Tkinter fails on Windows 95/98: why?

Sometimes, the import of Tkinter (or _tkinter) fails on Windows 95 or 98, complaining with a message like the following:

ImportError: DLL load failed: One of the library files needed
to run this application cannot be found.

It could be that you haven’t installed Tcl/Tk, but if you did install Tcl/Tk, and the Wish application works correctly, the problem may be that its installer didn’t manage to edit the autoexec.bat file correctly. It tries to add a statement that changes the PATH environment variable to include the Tcl/Tk ‘bin’ subdirectory, but sometimes this edit doesn’t quite work. Opening it with notepad usually reveals what the problem is.

(One additional hint, noted by David Szafranski: you can’t use long filenames here; e.g. use C:\PROGRA~1\Tcl\bin instead of C:\Program Files\Tcl\bin.)

CATEGORY: windows