sending image pil 1.1.5 by network

Fredrik Lundh fredrik at
Mon Nov 20 17:46:36 CET 2006

maxime_phan at wrote:

> Hello everyone, I'm trying to make a webcam software with python, pil
> library and enet (networking)
> Now I have in the client my pil image get from webcam, ready to be send
> by network.
> I do that:
> self.peer.send(0, image.tostring(), enet.FLAG_RELIABLE)
> and I have this error:
> TypeError: argument 2 must be string without null bytes, not str
> does someone know what kind of convertion I should do to make it work?

"self.peer", whatever that is, doesn't seem to support transfer
of binary data.  better talk to the vendor.

(you could in theory use base64 encoding or some other text-only 
representation of binary data, but that doesn't seem like a very 
practical solution for a webcam application.)


More information about the Python-list mailing list