[ python-Bugs-1233799 ] tkFileDialog.askopen... fails when dir=""

SourceForge.net noreply at sourceforge.net
Tue Jul 12 19:32:08 CEST 2005


Bugs item #1233799, was opened at 2005-07-07 00:08
Message generated for change (Comment added) made by birkenfeld
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1233799&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Tkinter
>Group: 3rd Party
>Status: Closed
Resolution: None
Priority: 5
Submitted By: Russell Owen (reowen)
Assigned to: Martin v. Löwis (loewis)
Summary: tkFileDialog.askopen... fails when dir=""

Initial Comment:
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.

----------------------------------------------------------------------

>Comment By: Reinhold Birkenfeld (birkenfeld)
Date: 2005-07-12 19:32

Message:
Logged In: YES 
user_id=1188172

Closing this as 3rd party, then.

----------------------------------------------------------------------

Comment By: Russell Owen (reowen)
Date: 2005-07-12 18:55

Message:
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.

----------------------------------------------------------------------

Comment By: Jeff Epler (jepler)
Date: 2005-07-12 15:10

Message:
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.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1233799&group_id=5470


More information about the Python-bugs-list mailing list