Re: [Biopython] PDBIO.save(fh) in BioPython 1.80 always closes the file handle
Adam Sjøgren <[email protected]> Wed, 07 Dec 2022 19:35:15 +0100
| Newsgroups | gmane.comp.python.bio.general |
|---|---|
| Organization | koldfront - analysis & revolution, Copenhagen, Denmark |
| Message-ID | <[email protected]> |
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