The following simple code fails on MacOS X 10.3 running the built-
in python 2.3 and Aqua Tcl/Tk 8.4.9:
import Tkinter
import tkFileDialog
root = Tkinter.Tk()
newPath = tkFileDialog.askopenfilename(
initialdir = "",
)
The error is:
Traceback (most recent call last):
File "tkFileDialog_askopen bug.py", line 5, in ?
newPath = tkFileDialog.askopenfilename(
File "/System/Library/Frameworks/Python.framework/Versions/2.3/
lib/python2.3/lib-tk/tkFileDialog.py", line 119, in askopenfilename
return Open(**options).show()
File "/System/Library/Frameworks/Python.framework/Versions/2.3/
lib/python2.3/lib-tk/tkCommonDialog.py", line 52, in show
s = w.tk.call(self.command, *w._options(self.options))
_tkinter.TclError: bad directory ""
The same code runs fine on unix Python 2.2.3 with unknown tcl/tk
and on and unix Python 2.4.1 with tcl/tk 8.4.9. it starts out in the
user's home directory as I'd expect.
Mind you, I know I can use None or not specify the initialdir
argument. But in my code it's a string that *might* be empty.
|