[Twisted-Python] sending images via PB
Jean-Paul Calderone
exarkun at divmod.com
Thu Dec 20 07:31:35 MST 2007
On Thu, 20 Dec 2007 17:50:12 +0900, Robert Gravina <robert at gravina.com> wrote:
>
>On Dec 20, 2007, at 5:04 PM, Robert Gravina wrote:
>>Hi All,
>>
>>I'm developing an application using Twisted PB, and I'd like to send image
>>data from server to client for display there.
>>
>>Specifically, I'm trying to display an image (e.g. a PNG, but might be
>>another type) in a wxPython client which should come from a Twisted server
>>somehow, and the client is already connected using PB.
>>
>>I suppose I can just send the raw file data as a string and use that...
>>but just thought I'd ask if anyone has any advice.
>
>No worries.. I was able to get it going by just sending the file contents,
>i.e.:
>
>#on server, open image
>image = open("images/test.png")
>data = image.read()
>#send data to client
For potentially large files, you might want to use FilePager from
twisted.spread.util, if you aren't already.
Jean-Paul
More information about the Twisted-Python
mailing list