473,386 Members | 1,706 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

win32ui CreateFileDialog Can't Set Dir

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
Jul 18 '05 #1
1 3947
SetOFNInitialDir is a method:
pd.SetOFNInitialDir(r'D:\Documents and Settings\John')
hth
Roger

"EricP" <fo*****************@yahoo.comNOSPAM> wrote in message
news:1Dknb.31818$mZ5.158181@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

Jul 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Me Mine | last post by:
i, I have trying to code a small console app that will allow a user to select a window and then create a screen capture of the window. I haven't been able to figure out how to do the screen...
0
by: Howard Lightstone | last post by:
I am trying to use the CreatePrintDialog routine to initialize a device context for the (default) printer but ..... I can't figure out the arguments. win32ui.CreatePrintDialog The first...
0
by: Chris Gonnerman | last post by:
I am rewriting an antique BASIC program in Python for a customer. The main feature of the program is printing a work order for a particular assembly; the BASIC program uses IBM OEM line-drawing...
2
by: Darcy Kahle | last post by:
I am trying to do some advanced printing in python using the win32ui module, and have run into an issue. I need to print a page landscape. As I could not determine how to specify the orientation...
3
by: MsKitty | last post by:
My client is used to clicking on the script name on her PC and getting a windows command line box which it runs in. Not fancy but did the job until recently... Now it can take up to 4 minutes...
1
by: Chris Lambacher | last post by:
Hi, This question has come up a few times on the list with no one giving a public answer. How do you use CreatePrintDialog from win32ui? About a year ago someone posted that: dlg =...
4
by: Joey C. | last post by:
Hello. I'm writing a program that creates a series of batch operations to convert movies to be used on iPodLinux. The programs that do the encoding and conversions are seperate from mine and all...
3
by: robert | last post by:
As soon as I install wxPython on a Py2.3.5, my win32ui / win32gui apps freak out. buttons in dialogs are magically pressed. backgrounds of dialogs are colored wrong... this is with current...
5
by: nobugus | last post by:
Just posting a solution to the problem of capturing the whole virtual screen area, including all monitors with python and pywin32. Because this doesn't work even with PIL's imagegrab module. ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.