Re: File Closing Problem in 2.3 and 2.4, Not in 2.5 (Final report)

2007-01-10 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Julio Biason wrote: > If I use a file() in a for, how to I explicitely close the file? > > > for line in file('contents'): >print line > > > Would this work like the new 'with' statement or it will only be closed > when the GC finds it? Only when the GC destroys it

Re: File Closing Problem in 2.3 and 2.4, Not in 2.5 (Final report)

2007-01-09 Thread Gabriel Genellina
At Wednesday 10/1/2007 02:36, Julio Biason wrote: [Kinda stealing the thread] (at least a related question!) If I use a file() in a for, how to I explicitely close the file? for line in file('contents'): print line Would this work like the new 'with' statement or it will only be close

Re: File Closing Problem in 2.3 and 2.4, Not in 2.5 (Final report)

2007-01-09 Thread Julio Biason
[Kinda stealing the thread] On Tue, Jan 09, 2007 at 09:05:30PM -0300, Gabriel Genellina wrote: > And do you actually need so many open files simultaneously? > Try to close them explicitely when you finish working on them - do > not rely on GC for closing files. This has *always* been the > recom

Re: File Closing Problem in 2.3 and 2.4, Not in 2.5 (Final report)

2007-01-09 Thread Mark T
"Gabriel Genellina" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > At Tuesday 9/1/2007 20:31, Carroll, Barry wrote: > >>I've spent about a day investigating our "too many open files" error. I >>found the following: >> >> 1. Windows XP allows a Python 2.5 script to open 509

RE: File Closing Problem in 2.3 and 2.4, Not in 2.5 (Final report)

2007-01-09 Thread Gabriel Genellina
At Tuesday 9/1/2007 22:03, Carroll, Barry wrote: The first assumption was correct: the file object is destroyed. The second assumption is apparently incorrect: the file handle is not released when the associated object is destroyed. These 'orphaned' file handles build up and when the OS hand

RE: File Closing Problem in 2.3 and 2.4, Not in 2.5 (Final report)

2007-01-09 Thread Carroll, Barry
Hi, Gabriel, > -Original Message- > From: Gabriel Genellina [mailto:[EMAIL PROTECTED] > Sent: Tuesday, January 09, 2007 4:06 PM > To: python-list@python.org > Subject: RE: File Closing Problem in 2.3 and 2.4, Not in 2.5 (Final > report) > > At Tuesday 9/1/2007 20:

RE: File Closing Problem in 2.3 and 2.4, Not in 2.5 (Final report)

2007-01-09 Thread Gabriel Genellina
At Tuesday 9/1/2007 20:31, Carroll, Barry wrote: I've spent about a day investigating our "too many open files" error. I found the following: 1. Windows XP allows a Python 2.5 script to open 509 concurrent files. And do you actually need so many open files simultaneously?

RE: File Closing Problem in 2.3 and 2.4, Not in 2.5 (Final report)

2007-01-09 Thread Carroll, Barry
John et al: I've spent about a day investigating our "too many open files" error. I found the following: 1. Windows XP allows a Python 2.5 script to open 509 concurrent files. 2. RedHat Fedora Core 1 allows a Python 2.3 script to open 1022 concurrent fi