sending image pil 1.1.5 by network

M

maxime_phan

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?

in tostring() function the default encoder is "raw", perhaps there is
one ok?
Thanks in advance
 
F

Fredrik Lundh

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.)

</F>
 
M

maxime_phan

it works with base64 thanks alot!!!, I know it's not very good
solution, but it's for a multiplayer checkers game with webcam, and I
already use enet everywhere
Fredrik Lundh a écrit :
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,013
Latest member
KatriceSwa

Latest Threads

Top