I'm having a problem similar to the query below, the problem being that the suggested
method doesn't work because the win32gui.CreateFileDialog method seems produce a dialog
with a read only attribute set, with no evident way to change it, in Python 2.4. Setting
the 4th argument to zero, for example, does not change the behavior.
SetOFNInitialDir is a method:
pd.SetOFNInitialDir(r'D:\Documents and Settings\John')
hth
Roger
"EricP" <fordphoto2020NOSPAM at yahoo.comNOSPAM> wrote in message
news:1Dknb.31818$mZ5.158181 at attbi_s54...
> I get the following error when I run this script to open a file dialog.
> I've searched the web and news groups for this issue and have not found
any
> references. I get the same behavior when I run it from Python or
Pythonwin.
> I'm new to win32... and would appreciate any help I can get.
>
> If I comment out the following line it works fine but I have to navigate
to
> my initial directory.....
>
> pd.SetOFNInitialDir = r'D:\Documents and Settings\John'
>
>
>
>
> # File Dialog Example
> import win32ui
> import win32con
> pd = win32ui.CreateFileDialog(1)
> pd.SetOFNInitialDir = r'D:\Documents and Settings\John'
> pd.DoModal()
> print 'filename =',pd.GetFileName()
> print 'path =', pd.GetPathName()
> pd=None
>
>
> Traceback (most recent call last):
> File "filedialog.py", line 4, in ?
> pd.SetOFNInitialDir = 'D:\Documents and Settings\Eric'
> TypeError: PyCFileDialog has read-only attributes
>
>
> Also is there a way to open the XP file dialog that has the navigation
> shortcuts on the left side of the dialog window?
>
> Thanks
> Eric
>
>
-- http://mail.python.org/mailman/listinfo/python-list