sending image pil 1.1.5 by network

Discussion in 'Python' started by maxime_phan@hotmail.com, Nov 20, 2006.

  1. Guest

    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, 2006
    #1
    1. Advertising

  2. 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>
    Fredrik Lundh, Nov 20, 2006
    #2
    1. Advertising

  3. Guest

    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 :

    > 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, 2006
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kal
    Replies:
    1
    Views:
    9,499
    Kevin Spencer
    Jun 21, 2004
  2. Jane Davis

    Network Service account over network

    Jane Davis, Jun 22, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    421
    Kevin Spencer
    Jun 22, 2005
  3. Daniel Mark
    Replies:
    1
    Views:
    687
    Fredrik Lundh
    Sep 25, 2006
  4. Andrew
    Replies:
    0
    Views:
    523
    Andrew
    Apr 5, 2007
  5. Sverre
    Replies:
    2
    Views:
    3,507
    Sverre
    Dec 17, 2009
Loading...

Share This Page