This works...
d = xmlrpclib.Binary(open("C:\\somefile.exe", "rb").read())

What I need is more like
screenShot = ImageGrab.Grab()
d = xmlrpclib.Binary(screenShot)

This doesn't work though.

On 12/30/06, Kent Johnson <[EMAIL PROTECTED]> wrote:

Chris Hengge wrote:
> I might have been unclear, or this tid-bit might have been lost in the
> thread... but I'm trying to send directly from ImageGrab.Grab(), without
> saving the data as a file. Thats where I'm getting hung... If it try to
> send an actual stored file, I have no problem. Is this maybe impossible?
> My thought was that I could just save a little process time and file
> fragmentation if I cut out the middle man, plus there really is no
> reason to save the screen capture on the server side.

Can you show the code that works? If you are writing your image data to
a file, then using something like Lee's example below, that just reads
the file data into a Binary object, you should be able to just create
the Binary object from the image data directly.

Kent

>
> Maybe I really need to look into SOAP for this sort of stuff? I'm just
> playing with the technology, and from the searching I've done, the
> XML-RPC seemed to fit my needs best. I could certainly be wrong though.
>
> Thanks for both of you giving me feedback.
>
> On 12/29/06, *Lee Harr* <[EMAIL PROTECTED]
> <mailto:[EMAIL PROTECTED]>> wrote:
>
>      >
http://www.velocityreviews.com/forums/t343990-xmlrpc-send-file.html
>     <http://www.velocityreviews.com/forums/t343990-xmlrpc-send-file.html
>
>      >
>      >Using this example I get error's about 'expected binary .read(),
>     but got
>      >instance instead.
>
>
>     I assume you are using this ...
>
>      >d = xmlrpclib.Binary(open("C:\\somefile.exe").read())
>
>
>     Are you using windows?
>
>     I think you would need to pass the binary flag to open ...
>
>             imagedata = open(filename, 'rb').read()
>
>
>
>     It's probably a good idea to use the binary flag if you are
expecting
>     binary data just in case it gets ported somewhere else later.
>
>
>      >I've just been using xmlrpclib and simplexmlrpcserver for this,
>     but I'm
>      >wondering if I should perhaps use twisted instead.
>
>     I've used xml-rpc to send image data before. It worked.
>
>     _________________________________________________________________
>     Don't just search. Find. Check out the new MSN Search!
>     http://search.msn.com/
>
>     _______________________________________________
>     Tutor maillist  -  Tutor@python.org <mailto:Tutor@python.org>
>     http://mail.python.org/mailman/listinfo/tutor
>     <http://mail.python.org/mailman/listinfo/tutor>
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor



_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to