bz2.decompress as file handle

Vincent Davis vincent at vincentdavis.net
Sun May 18 21:53:02 EDT 2014


I have a file compressed with bz2 and a function that expects a file handle.
When I decompress the bz2 file I get a string (binary) not a file handle.

Here is what I have that does not work. There is no error (thats a seperate
issue) CelFile.read just fails to read the data(string).

from Bio.Affy import CelFile
from bz2 import decompress,

with open('Tests/Affy/affy_v3_ex.CEL.bz2', 'rb') as handle:
    cel_data = decompress(handle.read())

c = CelFile.read(cel_data)



​​
​Thanks​
Vincent Davis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20140518/fa50180e/attachment.html>


More information about the Python-list mailing list