"g.franzkowiak" wrote: > I've read a pipe and store it in a object. > My next step was the separation from 4 bytes with > obj = string.join(list(dataObject)[:4] ==> '\x16 \x00 \x00 \x00' > and the converting by > value = struct.unpack('I', obj) generated the error > "unpack str size does not match format" > > Unfortunately is len(obj) 7, but integer lengt 4. > Why 7 ?
because string.join inserts a space between the bytes, by default (as your example shows) if you really need that join(list) thing (it's not clear how you read it, but I find it a bit hard to believe that you've managed to read it into some- thing that's supported by list but not unpack), you can do obj = string.join(list(dataObject)[:4], "") or obj = "".join(list(dataObject[:4])) or some variation thereof. </F> -- http://mail.python.org/mailman/listinfo/python-list