[pypy-dev] AttributeError: 'Message' object has no attribute '__sizeof__'

Amaury Forgeot d'Arc amauryfa at gmail.com
Thu Jul 5 10:36:39 CEST 2012


2012/7/5 Carlos Ferreira <carlosmf.pt at gmail.com>

> *  File "E:\Users\Claymore\Desktop\SimPy-Sims\Main.py", line 184, in
> TransmitMessage
>
> GlobalShelve["GlobalNetwork"][str(self.agentName)]["NetworkInterfacesStats"][self.interfaceName]["MessagesTraceInput"].append({"arrivalTime":now(),
> "messageID":message.messageID, "sizeInBytes":message.__sizeof__()})
> AttributeError: 'Message' object has no attribute '__sizeof__'
> *
>
> Can anyone help me here ?


PyPy does not implement __sizeof__.
You have two choices here:
remove the call from the code (it's seems to be only for information
purpose),
or implement the __sizeof__ method in the Message class, by returning some
random value.


-- 
Amaury Forgeot d'Arc
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20120705/e270e22c/attachment.html>


More information about the pypy-dev mailing list