"Robert Rawlins - Think Blue" <[EMAIL PROTECTED]>
wrote in news:[EMAIL PROTECTED]:
> Thanks for your ideas guys,
>
> I'm unfortunately tied to 2.4 so don't have the full try except
> status, but I'm now working with the following code:
>
> def addApp(self, event):
> try:
> logfile =
> open('/pblue/new/Logs/Application.csv','a')
>
> now = datetime.datetime.now()
> logstring = '%s,%s \n' % (event, str(now))
>
> try:
> logfile.write(logstring)
> finally:
> logfile.close()
> except:
> self.addApp(event)
>
> I'm trying to slowly debug my app and get rid of all the memory leaks,
> but its pain staking work, any help you can offer on that stuff would
> be a god send, I'm a little reluctant about posting all my app code on
> the lists as I'd like to keep some of it private.
>
> How does that new version look? A little tidier?
>
> Thanks guys,
>
Now, you are sure the file is always close. What I don't think is
correct is to retry to re-write the event (cause if opening the file
crashed ones there are very good chances that it will throw the 2nd
time).
./alex
--
.w( the_mindstorm )p.
--
http://mail.python.org/mailman/listinfo/python-list