This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: tkFileDialog.askopen... fails when dir=""
Type: Stage:
Components: Tkinter Versions:
process
Status: closed Resolution:
Dependencies: Superseder:
Assigned To: loewis Nosy List: georg.brandl, jepler, loewis, reowen
Priority: normal Keywords:

Created on 2005-07-06 22:08 by reowen, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Messages (4)
msg25739 - (view) Author: Russell Owen (reowen) Date: 2005-07-06 22:08
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.
msg25740 - (view) Author: Jeff Epler (jepler) Date: 2005-07-12 13:10
Logged In: YES 
user_id=2772

At first glance, this appears to be a bug or an incompatible
change in Tk between the old version and Aqua 8.4.9.

If you know the name of the 'wish' executable that uses the
same version of Tcl/Tk as your Python 2.3, please check
whether the tcl command
   tk_getOpenFile -initialdir {}
fails.  If it does, then this is a Tcl/Tk bug or
incompatible change, and I believe this tracker item should
be closed.  Only if that works, but the Python equivalent
doesn't, is there a reason to treat this as a bug in
Python/Tkinter.
msg25741 - (view) Author: Russell Owen (reowen) Date: 2005-07-12 16:55
Logged In: YES 
user_id=431773

The suggested tk command does fail:

() 1 % tk_getOpenFile -initialdir {}
bad directory ""

so I'll report this as a Tk bug.
msg25742 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2005-07-12 17:32
Logged In: YES 
user_id=1188172

Closing this as 3rd party, then.
History
Date User Action Args
2022-04-11 14:56:12adminsetgithub: 42167
2005-07-06 22:08:18reowencreate