Re: [Biopython] PDBIO.save(fh) in BioPython 1.80 always closes the file handle

Peter Cock <[email protected]> Fri, 16 Jun 2023 07:20:55 +0100
Newsgroups gmane.comp.python.bio.general
Message-ID <CAKVJ-_454EEJ-BB5sfWcj8wA+MnQXg4f-z3DE2wQfPMUdfA1zQ@mail.gmail.com>
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 <[email protected]> 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."                                                [email protected]
>
> _______________________________________________
> Biopython mailing list  -  [email protected]
> https://mailman.open-bio.org/mailman/listinfo/biopython
_______________________________________________
Biopython mailing list  -  [email protected]
https://mailman.open-bio.org/mailman/listinfo/biopython