win32ui CreateFileDialog Can't Set Dir

EricP fordphoto2020NOSPAM at yahoo.comNOSPAM
Mon Oct 27 21:36:46 EST 2003


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






More information about the Python-list mailing list