Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #94881
| Newsgroups | comp.lang.python |
|---|---|
| Date | 2015-08-01 17:50 -0700 |
| References | (3 earlier) <b0d90e04-000f-4e5d-af60-995320b50029@googlegroups.com> <871tfmvoqc.fsf@elektro.pacujo.net> <mailman.1138.1438454762.3674.python-list@python.org> <0310f559-8700-4e53-8e04-16eaf9e372b7@googlegroups.com> <87si82u8gh.fsf@elektro.pacujo.net> |
| Message-ID | <55386de2-659a-4bad-a481-09fcea1c4ef0@googlegroups.com> (permalink) |
| Subject | Re: Send data to asyncio coroutine |
| From | Javier <jcarmena@gmail.com> |
El sábado, 1 de agosto de 2015, 21:15:07 (UTC+2), Marko Rauhamaa escribió: > Javier <jcarmena@gmail.com>: > > > My intention now is to use the asyncio.StreamReader passed as argument > > to the asyncio.start_server callback to read objects serialized with > > pickle. The problems are that pickle cant read from it (because dont > > yield from the full stack) and that I don't know the exact length of > > each serialized object, so I can't extract data manually. > > > > Knows anybody the steps to follow? > > You probably need to frame your pickled encoding. A simple thing would > be to use struct.pack/unpack to encode the length of the pickle encoding > in front of the pickle encoding. When decoding, you first read out the > length, then the pickle encoding, and finally you unpickle the payload. > > > Marko Great! it works! I could not find a way to send an integer with fixed length, struct.pack/unpack does the job perfectly. Thanks!
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Send data to asyncio coroutine jcarmena@gmail.com - 2015-07-21 04:31 -0700
Re: Send data to asyncio coroutine Ian Kelly <ian.g.kelly@gmail.com> - 2015-07-21 07:35 -0600
Re: Send data to asyncio coroutine Javier <jcarmena@gmail.com> - 2015-07-28 14:17 -0700
Re: Send data to asyncio coroutine Javier <jcarmena@gmail.com> - 2015-07-28 15:41 -0700
Re: Send data to asyncio coroutine Ian Kelly <ian.g.kelly@gmail.com> - 2015-07-28 15:20 -0800
Re: Send data to asyncio coroutine Ian Kelly <ian.g.kelly@gmail.com> - 2015-07-28 15:06 -0800
Re: Send data to asyncio coroutine Rustom Mody <rustompmody@gmail.com> - 2015-07-28 19:52 -0700
Re: Send data to asyncio coroutine Javier <jcarmena@gmail.com> - 2015-07-29 07:24 -0700
Re: Send data to asyncio coroutine Javier <jcarmena@gmail.com> - 2015-08-01 09:07 -0700
Re: Send data to asyncio coroutine Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-08-01 17:41 +0100
Re: Send data to asyncio coroutine Javier <jcarmena@gmail.com> - 2015-08-01 11:22 -0700
Re: Send data to asyncio coroutine Marko Rauhamaa <marko@pacujo.net> - 2015-08-01 21:38 +0300
Re: Send data to asyncio coroutine Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-08-01 19:45 +0100
Re: Send data to asyncio coroutine Javier <jcarmena@gmail.com> - 2015-08-01 12:07 -0700
Re: Send data to asyncio coroutine Marko Rauhamaa <marko@pacujo.net> - 2015-08-01 22:14 +0300
Re: Send data to asyncio coroutine Javier <jcarmena@gmail.com> - 2015-08-01 17:50 -0700
Re: Send data to asyncio coroutine Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-08-01 20:33 +0100
Re: Send data to asyncio coroutine Chris Angelico <rosuav@gmail.com> - 2015-08-02 09:28 +1000
Re: Send data to asyncio coroutine Marko Rauhamaa <marko@pacujo.net> - 2015-08-01 22:09 +0300
Re: Send data to asyncio coroutine Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-08-01 20:29 +0100
Re: Send data to asyncio coroutine Marko Rauhamaa <marko@pacujo.net> - 2015-08-01 20:18 +0300
Re: Send data to asyncio coroutine Javier <jcarmena@gmail.com> - 2015-08-01 10:50 -0700
Re: Send data to asyncio coroutine Marko Rauhamaa <marko@pacujo.net> - 2015-08-01 21:33 +0300
csiph-web