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


Groups > comp.lang.python > #28038

Re: issue with struct.unpack

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 <python-python-list@m.gmane.org>
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 <wlfraed@ix.netcom.com>
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 <python-list.python.org>
List-Unsubscribe <http://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 <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3915.1346207471.4697.python-list@python.org> (permalink)
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

Show key headers only | View raw


On Tue, 28 Aug 2012 15:34:11 -0700 (PDT), 9bizy
<a.m.akingbulu-11@student.lboro.ac.uk> 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/

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


Thread

issue with struct.unpack 9bizy <a.m.akingbulu-11@student.lboro.ac.uk> - 2012-08-25 11:34 -0700
  Re: issue with struct.unpack Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-08-25 20:12 +0100
  Re: issue with struct.unpack MRAB <python@mrabarnett.plus.com> - 2012-08-25 20:16 +0100
    Re: issue with struct.unpack 9bizy <a.m.akingbulu-11@student.lboro.ac.uk> - 2012-08-28 15:35 -0700
      Re: issue with struct.unpack MRAB <python@mrabarnett.plus.com> - 2012-08-28 23:53 +0100
      Re: issue with struct.unpack Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-08-28 22:40 -0400
    Re: issue with struct.unpack 9bizy <a.m.akingbulu-11@student.lboro.ac.uk> - 2012-08-28 15:35 -0700
  Re: issue with struct.unpack Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-08-25 19:31 -0400
    Re: issue with struct.unpack Alexander Blinne <news@blinne.net> - 2012-08-26 14:53 +0200
  Re: issue with struct.unpack MRAB <python@mrabarnett.plus.com> - 2012-08-28 23:49 +0100
    Re: issue with struct.unpack 9bizy <a.m.akingbulu-11@student.lboro.ac.uk> - 2012-08-28 16:01 -0700
    Re: issue with struct.unpack MRAB <python@mrabarnett.plus.com> - 2012-08-29 00:36 +0100
      Re: issue with struct.unpack 9bizy <a.m.akingbulu-11@student.lboro.ac.uk> - 2012-08-28 16:55 -0700
      Re: issue with struct.unpack 9bizy <a.m.akingbulu-11@student.lboro.ac.uk> - 2012-08-28 16:55 -0700
  Re: issue with struct.unpack Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2012-08-28 22:31 -0400

csiph-web