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


Groups > comp.lang.python > #28038

Re: issue with struct.unpack

From Dennis Lee Bieber <wlfraed@ix.netcom.com>
Subject Re: issue with struct.unpack
Date 2012-08-28 22:31 -0400
Organization > Bestiaria Support Staff <
References <2cc8b390-0b7a-4a0f-ac88-113daf65eba5@googlegroups.com> <5653b3e0-1e37-4f70-8257-6630eacdce5f@googlegroups.com>
Newsgroups comp.lang.python
Message-ID <mailman.3915.1346207471.4697.python-list@python.org> (permalink)

Show all headers | 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