Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!feeder.erje.net!newsfeed.xs4all.nl!newsfeed5.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.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'argument': 0.04; 'subject:skip:s 10': 0.05; '16-bit': 0.09; 'byte,': 0.09; 'errors:': 0.09; 'integers': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'unpack': 0.09; 'aug': 0.13; 'data)': 0.16; 'input.': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'subject:issue': 0.16; 'string': 0.17; 'bytes': 0.17; 'tries': 0.17; 'input': 0.18; 'combination': 0.22; 'specified': 0.23; 'seems': 0.23; '(most': 0.27; 'header:X -Complaints-To:1': 0.28; 'node': 0.29; 'print': 0.32; 'traceback': 0.33; 'url:home': 0.33; 'to:addr:python-list': 0.33; 'list': 0.35; 'needed': 0.35; 'received:org': 0.36; 'really': 0.36; 'but': 0.36; 'subject:with': 0.36; 'charset:us-ascii': 0.36; 'data': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'your': 0.60; "you've": 0.61; 'dennis': 0.91; 'received:108': 0.91 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Dennis Lee Bieber Subject: Re: issue with struct.unpack Date: Tue, 28 Aug 2012 22:31:02 -0400 Organization: > Bestiaria Support Staff < References: <2cc8b390-0b7a-4a0f-ac88-113daf65eba5@googlegroups.com> <5653b3e0-1e37-4f70-8257-6630eacdce5f@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: adsl-108-79-222-169.dsl.klmzmi.sbcglobal.net X-Newsreader: Forte Agent 3.3/32.846 X-No-Archive: YES X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 29 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1346207471 news.xs4all.nl 6878 [2001:888:2000:d::a6]:42039 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:28038 On Tue, 28 Aug 2012 15:34:11 -0700 (PDT), 9bizy declaimed the following in gmane.comp.python.general: > > for Node in csv.reader(file('s_data.xls')): > data.append(list((file('s_data.xls')))) > > > data = struct.unpack('!B4HH', data) > print "s_data.csv: ", data > > I tries so many format for the struct.unpack but I got this errors: > > Traceback (most recent call last): > > data = struct.unpack('!B4HH', data) > struct.error: unpack requires a string argument of length 11 > Which seems reasonable -- you've specified 1 byte, and 5 16-bit integers => 11 bytes needed for input. Have you examined what your input really contains? I see a list given the combination of .append() and list() -- Wulfraed Dennis Lee Bieber AF6VN wlfraed@ix.netcom.com HTTP://wlfraed.home.netcom.com/