Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #71739

bz2.decompress as file handle

From Vincent Davis <vincent@vincentdavis.net>
Date 2014-05-18 19:53 -0600
Subject bz2.decompress as file handle
Newsgroups comp.lang.python
Message-ID <mailman.10118.1400464410.18130.python-list@python.org> (permalink)

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

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

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

bz2.decompress as file handle Vincent Davis <vincent@vincentdavis.net> - 2014-05-18 19:53 -0600

csiph-web