Home

"Robert Rawlins - Think Blue" <robert.rawlins@thinkbluemedia.co.uk>
wrote in news:13677.732498809$1186148538@news.gmane.org:

> 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.

previous
next

is speed of exec of a member function always impacted by an extra layer in a class hierarchy?
Processing drag & drop on the desktop
Re: How can I access non-static variables from static funcition?
Re: How to store the data of a large map<string, int>?
Re: regexp problem in Python
Fundacja Sloneczko
Dzieci Niczyje
Pajacyk
Mam Marzenie
Krwinka