how to use xdrlib

Alan Wilter Sousa da Silva awilter at ebi.ac.uk
Sun Aug 22 05:05:22 EDT 2010


Hi there,

I am trying to understand how xdrlib works as I want to read files in this
format. The problem is I don't much about xdr (although I read
http://docs.python.org/library/xdrlib.html and RFC 1832).

Another problem is I don't know how the file I want to read was encoded.

So when I do something like:

import xdrlib

f = open('file.xdr').read()
data = xdrlib.Unpacker(f)

Then, I don't know which "unpack_*" to use.

If I use,

repr(data.unpack_string())

sometimes it returns something meaningful like:

"'Ryckaert-Bell.'"

but other times,

'\x00\x00\x00\x04Bond\x00\x00\x00\x05Angle\x00\x00\x00\x00\x00\x00\x0bProper
Dih.\x00'

if not a error.

Well, as you see, I am a bit lost here and any hint would be very
appreciated.

Thanks in advance,

Alan

-- 
Alan Wilter S. da Silva, D.Sc. - CCPN Research Associate
Department of Biochemistry, University of Cambridge.
80 Tennis Court Road, Cambridge CB2 1GA, UK.
>>http://www.bio.cam.ac.uk/~awd28<<
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20100822/2b9f1ddb/attachment.html>


More information about the Python-list mailing list