Hi,
I do not know whether this is a Python, wxPython, Windows, or coding question ...
I have a program that changes disk/directory using os.chdir (verified OK with os.getcwd) then opens a file dialog box using wx.FileDialog with "" as default dir.
I expected to be in my chdir directory but found myself in the windows desktop.
Any clue ?
Regards,
Philippe
···
--
SnakeCard, LLC
Philippe C. Martin
www.snakecard.com
Why don't you just use os.getcwd() as the default directory?
···
On 12/3/05, Philippe C. Martin <pmartin@snakecard.com> wrote:
Hi,
I do not know whether this is a Python, wxPython, Windows, or coding
question ...
I have a program that changes disk/directory using os.chdir (verified OK
with os.getcwd) then opens a file dialog box using wx.FileDialog with ""
as default dir.
I expected to be in my chdir directory but found myself in the windows
desktop.
Any clue ?
Regards,
Philippe
--
SnakeCard, LLC
Philippe C. Martin
www.snakecard.com
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org
I will, but I want to understand.
Regards,
Philippe
Michael Moriarity wrote:
···
pmartin@snakecard.comwww.snakecard.comwxPython-users-unsubscribe@lists.wxwidgets.orgwxPython-users-help@lists.wxwidgets.orgwxPython-users-unsubscribe@lists.wxwidgets.orgwxPython-users-help@lists.wxwidgets.org
-- SnakeCard, LLC
Philippe C. Martin
www.snakecard.com
For Windows, behind the scenes the default directory argument gets put into the lpstrInitialDir member of an OPENFILENAME structure.
If you pass an empty string there is a complex algorithm that Windows uses to determine which directory to show. In particular, if the current directory does not contain any files of the specified filter types, Windows may show the personal files directory or the Desktop.
Here is the documentation from Microsoft’s site. Look for “lpstrInitialDir”:
http://tinyurl.com/5wchk
By the way, you may be able to force it to use the current directory by passing "." as the default dir.
Regards,
Nate
···
On Dec 3, 2005, at 6:58 AM, Philippe C. Martin wrote:
I have a program that changes disk/directory using os.chdir (verified OK with os.getcwd) then opens a file dialog box using wx.FileDialog with "" as default dir.
I expected to be in my chdir directory but found myself in the windows desktop.
Any clue ?
Try '.' instead of an empty string. Single dot refers to the current directory.
os.curdir is even better. 