[Biopython-dev] Notification: incoming/48
Gavin E. Crooks
gec at compbio.berkeley.edu
Wed Oct 24 21:03:46 EDT 2001
The new code dosn't work as intended, since parse() may raise an exception.
This
def parse_file(self, filename):
h = open(filename)
retval = self.parse(h)
h.close()
return retval
should be
def parse_file(self, filename):
h = open(filename)
try:
return self.parse(h)
finally :
h.close()
Gavin
p.s. The viewcvs diff appears to be broken.
On Wed, 24 Oct 2001, you wrote:
> JitterBug notification
>
> jchang changed notes
>
> Message summary for PR#48
> From: gec at compbio.berkeley.edu
> Subject: Unclosed file
> Date: Wed, 24 Oct 2001 13:17:43 -0400
> 0 replies 0 followups
> Notes: It gets closed implicitly as the reference in parse goes out of scope. However,
> you're right that it's better to be done explicitly, so I've made the changes in
> the file.
>
> Thanks,
> Jeff
>
>
> ====> ORIGINAL MESSAGE FOLLOWS <====
>
> From gec at compbio.berkeley.edu Wed Oct 24 13:17:43 2001
> Received: from localhost (localhost [127.0.0.1])
> by pw600a.bioperl.org (8.11.2/8.11.2) with ESMTP id f9OHHgB21133
> for <biopython-bugs at pw600a.bioperl.org>; Wed, 24 Oct 2001 13:17:43 -0400
> Date: Wed, 24 Oct 2001 13:17:43 -0400
> Message-Id: <200110241717.f9OHHgB21133 at pw600a.bioperl.org>
> From: gec at compbio.berkeley.edu
> To: biopython-bugs at bioperl.org
> Subject: Unclosed file
>
> Full_Name: Gavin Crooks
> Module: ParserSupport.AbstractParser
> Version:
> OS:
> Submission from: sdn-ar-005casfrmp182.dialsprint.net (158.252.212.184)
>
>
> AbstractParser.parse_file(self,filename) does not close the file it opens.
>
>
> _______________________________________________
> Biopython-dev mailing list
> Biopython-dev at biopython.org
> http://biopython.org/mailman/listinfo/biopython-dev
More information about the Biopython-dev
mailing list