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


Groups > comp.lang.python > #71739

bz2.decompress as file handle

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 <vincent@vincentdavis.com>
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 <vincent@vincentdavis.net>
Date Sun, 18 May 2014 19:53:02 -0600
Subject bz2.decompress as file handle
To "python-list@python.org" <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 <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.10118.1400464410.18130.python-list@python.org> (permalink)
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

Show key headers only | 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