Nevermind, the file was empty. Guess it got written over somehow. Sorry
to be so quick on the enter button.
--vicki
路路路
-----Original Message-----
From: Stanfield, Vicki {D167~Indianapolis}
Sent: Monday, March 15, 2004 2:21 PM
To: 'wxpython-users@lists.wxwindows.org'
Subject: Question about wxFileDialog usageI am trying to read in data from a file that I have created. The file
exists, and the following code allows me to select the file for
reading. However when I try to access the data, nothing happens. Here
is the code to run the wxFileDialog and select and open the file.#Go ahead and open the data file now so that we don't have
timing problems later.
#Pop up a dialog to name the data file that we'll take our
input from
self.datafilesel = wxFileDialog(self, message="Choose a
data file.",
defaultDir = "C:/",wildcard = "*.dat", )
#Display the File Dialog
self.datafilesel.ShowModal()
#Kill the File Dialog after obtaining input
self.datafilesel.Destroy()
datafile = self.datafilesel.GetFilename()
#Open data file with selected name for reading
data_file = open('C:/'+datafile, 'r+')It seems to work to this point, but after a little more code is
executed, I try this:if: <snip>
else: #Transmit data from input file.
print "Got here.\n"
for line in data_file.readlines():
print "Got here too.\n"
print lineI get the first "Got here." but not the "Got here too." Does anyone
see what I am doing wrong here?--vicki