Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder3.xlned.com!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.049 X-Spam-Evidence: '*H*': 0.90; '*S*': 0.00; 'subject:file': 0.07; 'subject:skip:b 10': 0.07; 'string': 0.09; 'received:209.85.219': 0.09; "'rb')": 0.16; '8bit%:32': 0.16; 'expects': 0.16; 'seperate': 0.16; 'import': 0.22; 'to:name:python- list@python.org': 0.22; 'error': 0.23; 'function': 0.29; 'message- id:@mail.gmail.com': 0.30; 'work.': 0.31; 'file': 0.32; 'skip:d 20': 0.34; 'received:209.85': 0.35; 'received:google.com': 0.35; 'there': 0.35; 'received:209': 0.37; 'to:addr:python-list': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'read': 0.60; 'skip:o 30': 0.61; 'skip:\xe2 10': 0.65; 'here': 0.66; '\xc2\xa0\xc2\xa0': 0.74; 'subject:handle': 0.84; '8bit%:18': 0.93 X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:from:date:message-id:subject:to :content-type; bh=2/8DhpLwbgm5D/xTw3JWH/CZh375JXvaMJWZf4yvHzg=; b=IBRDmJ32yDVJWlzkQiFIIdYRuotcRfKh8CIz+9kiluRmVgG1gTd3B1jqv79hs1po+c Ho3205O6RX2qCXJg9pw5Z8ST+eY8EUfNkU/EJlNSEgFWsV6w3gdcnV9pnOqRGoPTMsjn /HbYstalcOyf6bzaXCYkZlYaSEYSemmK5L1bxZM36EaStSIlAwuPSBEXIQqbGGa7m8mT yVG8P5WBqXoc7eChoK2HWTnGhleKItbnZsGohoyRuNJ6KrscdRx9oFdFB+ASe4tL4wni CTFAniOiz3sg1iaA+BeBX6Sc6MTQ/Y0sMFWBLiMPfpVg1q5CDyTPnm9RWWZdZ5kNlQ8F JBEg== X-Gm-Message-State: ALoCoQkDHQSd2AclaTm8BstPgPO6+yVAlD5p43HISrBYT+SUfAFPelKWuLYrjpmglDTSSY0Yy/5U X-Received: by 10.182.128.168 with SMTP id np8mr23882276obb.21.1400464402392; Sun, 18 May 2014 18:53:22 -0700 (PDT) MIME-Version: 1.0 From: Vincent Davis Date: Sun, 18 May 2014 19:53:02 -0600 Subject: bz2.decompress as file handle To: "python-list@python.org" Content-Type: multipart/alternative; boundary=089e0153861e39b3c604f9b7071a X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 73 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1400464410 news.xs4all.nl 2958 [2001:888:2000:d::a6]:45983 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:71739 --089e0153861e39b3c604f9b7071a Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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 =3D decompress(handle.read()) c =3D CelFile.read(cel_data) =E2=80=8B=E2=80=8B =E2=80=8BThanks=E2=80=8B Vincent Davis --089e0153861e39b3c604f9b7071a Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
I have a file compressed with bz2 and a functio= n 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)=C2=A0CelFile.read=C2=A0just=C2=A0fails to read the data(string).
=C2=A0
from Bio.Affy import CelFile
from bz2 = import decompress,

<= /font>
with open('Tests/Affy/affy_v3_ex.CEL.bz2', 'rb') as = handle:
=C2= =A0 =C2=A0 cel_data =3D decompress(handle.read())
=C2=A0 =C2=A0=C2= =A0
c =3D CelFile.read(cel_data)

=

=
=E2=80=8B=E2=80=8B
=E2=80=8BThanks=E2=80=8B
Vincent Davis

--089e0153861e39b3c604f9b7071a--