Created on 2003-09-29 19:01 by xant, last changed 2022-04-10 16:11 by admin. This issue is now closed.
Messages (4) |
|
|
msg60400 - (view) |
Author: Deleted User xant (xant) |
Date: 2003-09-29 19:01 |
Python.org's official windows installer makes installing Tkinter optional; there is a component you can uncheck during installation. If this box is unchecked, tk84.dll and friends are not installed but Tkinter.py, _tkinter.pyd and a few others are installed. This makes it difficult to write code that does: .try: . import Tkinter .except ImportError: . # fallback to textmode operation When 'import Tkinter' executes on Windows, Windows attempts to load tk84.dll, and the result is a popup error saying . "The dynamic link library tk84.dll could not be found in the specified path (...my system path...)" I recommend that Tkinter.py and friends not be installed when that box is unchecked, since they can't do anything useful anyway. |
|
|
msg60401 - (view) |
Author: Terry J. Reedy (terry.reedy) *  |
Date: 2003-10-05 16:44 |
Logged In: YES user_id=593130 I believe that one reason to uncheck the load tk84 box is if one already has it loaded and running. If so, not loading Tkinter.py is exactly the wrong thing to do, and the needed fix is for the Tkinter import to somehow catch the Windows error (no idea how) and convert it to Python ImportError. |
|
|
msg60402 - (view) |
Author: Deleted User xant (xant) |
Date: 2003-10-05 17:13 |
Logged In: YES user_id=6365 That didn't occur to me. I don't know if it's possible to catch the error message before it becomes a popup window, although it certainly should be, but there's an easier way: .from twisted.runner.procutils import which .if sys.version_info[:2]==(2,2): . tkdll='tk83.dll' .else: . tkdll='tk84.dll' .if which(tkdll): . ... At this point I "try: import Tkinter", but you probably want to negate the condition and raise ImportError here instead. If it's not in the system binary path, it's probably not installed; if it is installed, the user wants to add it to the binary path anyway. (The ImportError itself can suggest this course of action.) Of course, Twisted isn't in stdlib, but which() is a very small utility function: http://cvs.twistedmatrix.com/cvs/twisted/runner/procutils.py?rev=1.2&content-type=text/vnd.viewcvs-markup |
|
|
msg79343 - (view) |
Author: Guilherme Polo (gpolo) *  |
Date: 2009-01-07 15:44 |
The bug mentioned by the OP doesn't occur with the newer installers, closing. |
|
|
History |
|
|
|
Date |
User |
Action |
Args |
2022-04-10 16:11:29 |
admin |
set |
github: 39332 |
2009-01-07 15:44:00 |
gpolo |
set |
status: open -> closednosy: + gpoloresolution: out of datemessages: + |
2008-01-20 18:58:29 |
christian.heimes |
set |
type: behaviorversions: + Python 2.6, Python 2.5, Python 3.0, - Python 2.3 |
2003-09-29 19:01:26 |
xant |
create |
|