By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,550 Members | 1,189 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,550 IT Pros & Developers. It's quick & easy.

sending image pil 1.1.5 by network

P: n/a
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

Nov 20 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
ma*********@hotmail.com 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.)

</F>

Nov 20 '06 #2

P: n/a
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 :
ma*********@hotmail.com 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.)

</F>
Nov 21 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.