[Biopython] PDBIO.save(fh) in BioPython 1.80 always closes the file handle
Peter Cock
p.j.a.cock at googlemail.com
Fri Jun 16 02:20:55 EDT 2023
Hi Adam,
You flagged this discussion the context of Biopython 1.82 planning.
I believe this was already fixed in Biopython 1.81, via this pull request:
https://github.com/biopython/biopython/pull/4200
Its a shame your email was overlooked, in hindsight I would have
recommended opening an issue - but happily the same problem
was reported later that month (with a pull request opened without
bothering with an issue).
Peter
On Wed, Dec 7, 2022 at 6:35 PM Adam Sjøgren <asjo at koldfront.dk> wrote:
>
> Adam writes:
>
> > tmp = StringIO()
>
> Adding:
> import types
> tmp.close=types.MethodType(lambda _: True, tmp)
>
> here is a workaround.
>
> > io.save(tmp)
> > tmp.seek(0)
> > # Get content
> > content = tmp.read().encode('utf-8')
>
> But it feels wrong :-)
>
>
> /Adam
>
> --
> "A cat has nine lives, but a bullfrog croaks every Adam Sjøgren
> day." asjo at koldfront.dk
>
> _______________________________________________
> Biopython mailing list - Biopython at biopython.org
> https://mailman.open-bio.org/mailman/listinfo/biopython
More information about the Biopython
mailing list