Re: tbufferfile in pyroot

From: <wlavrijsen_at_lbl.gov>
Date: Sun, 13 Nov 2011 22:59:02 -0800


Andy,

> msg = socket.recv(copy=False)
> buf = ROOT.TBufferFile(ROOT.TBuffer.kRead, len(msg.buffer),
> sip.voidptr(id(msg.buffer)).ascobject(), False)
> o = id(buf.ReadObjectAny(ROOT.TH1F.Class())) # error!
>
> I use SIP for casting, since I believe that's what PyROOT is written with

it's not: PyROOT is based on CINT dictionaries. Are you sure btw. that the result of id() will yield a pointer to the underlying object for msg.buffer? It normally (and only in CPython) is a pointer to the python object; it will not work for PyROOT objects for sure (use ROOT.AsCObject() instead and pass that result around for those cases, but I don't know what socket returns).

Best regards,

            Wim

-- 
WLavrijsen_at_lbl.gov    --    +1 (510) 486 6411    --    www.lavrijsen.net
Received on Mon Nov 14 2011 - 07:59:28 CET

This archive was generated by hypermail 2.2.0 : Mon Nov 14 2011 - 23:50:02 CET