Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #106739

Re: (Python 3.5) Asyncio and an attempt to run loop.run_until_complete() from within a running loop

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Ian Kelly <ian.g.kelly@gmail.com>
Newsgroups comp.lang.python
Subject Re: (Python 3.5) Asyncio and an attempt to run loop.run_until_complete() from within a running loop
Date Sat, 9 Apr 2016 09:38:05 -0600
Lines 14
Message-ID <mailman.124.1460216327.2253.python-list@python.org> (permalink)
References <33e44698-2625-47c4-9595-00a8c79f27ad@googlegroups.com> <CALwzid=nr4FTtt-iQJEG8CwnpbXR-=QctCous0fi0YdC1BP_cA@mail.gmail.com> <CALwzidkHOTXpKN66n9o-2Y0qaCVZAz=CbX_Vr1C6f12QoXUMnA@mail.gmail.com>
Mime-Version 1.0
Content-Type text/plain; charset=UTF-8
X-Trace news.uni-berlin.de Ub59My4wb4UvACdBijg/eQAY2UAG6s+pofSLKpB+e+xA==
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.011
X-Spam-Evidence '*H*': 0.98; '*S*': 0.00; 'received:209.85.223': 0.03; 'subject:Python': 0.05; 'loop.': 0.09; 'def': 0.13; '2016': 0.16; 'alexander': 0.16; 'async': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'redundant.': 0.16; 'subject:run': 0.16; 'wrote:': 0.16; 'am,': 0.23; 'sat,': 0.23; 'header:In-Reply-To:1': 0.24; 'fri,': 0.27; 'message-id:@mail.gmail.com': 0.27; 'becomes': 0.30; 'subject:) ': 0.32; 'received:google.com': 0.35; 'list,': 0.36; 'received:209.85': 0.36; 'to:addr:python-list': 0.36; 'pm,': 0.36; 'received:209': 0.38; 'mean': 0.38; 'does': 0.39; 'subject:from': 0.39; 'to:addr:python.org': 0.40; 'your': 0.60; 'different': 0.63; 'here': 0.66; 'results': 0.66; 'to:name:python': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=y1R7zbagk5UTWvcuNAy/VbV3fq+Hah1e6maZAMIQhqI=; b=MvOlrK8vKY19XHc623H4vKj0wN7zxy4ea5kiiBdPynSDX2J9MuH1zLR6X03oqxPHaw E3Lnamqy7bJeo1ApgKBCdi2mvZvyVRkXoaF13ZWTEmTZLmXAI8azhLUMjcetgGL/4QZC Q3XDfQow02waQYhkSjeDPhoTaBMVi296YZg2msbNJKdVqOxLn7ndpN9+reCsjshZeC8a mEK70JM1cI1af8xAnnW+wIvbQTytY8b0ZlaOuzVHJNqxl2/cHlpkGpBeTOUvYBlsKLR3 WhDNrTyox2oxf0LyaSsRayfh2LL1igLAVWffcajET4dnahNYsYgOQrpeozJ8Dtqr/0J3 P4/w==
X-Google-DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=y1R7zbagk5UTWvcuNAy/VbV3fq+Hah1e6maZAMIQhqI=; b=kNSbFggQqQ9dBfaQXKs72hjmyevHQghLDostPUZoRwLrp3NYM1HMRRecEogk2nDiuQ avWEccWc4f4hCAzvFR/x6ZMt5j5YPAbneZly++JjRJCL9ZGYOZ2N9+hFQ4c0IkZSNYNC UpGnEiRrgx65hIBWqefGKhHmiZHZAfiP1MuU4J47gphn46xb+seCDiwkZHPfbLd2VeBz DC6yQ9SMD6IUWgdxBbNwtxesj3YZadrLoP3zJLn3YO6U0hArgUWq3QMs7Z1lSUwkgsV6 H0P4jET2ijGDLSoAMSlr3JmQZUK4ca6jTbfYrpWH9ErlK47eY0KZePHUv8PbugwwPu5y 6Vhg==
X-Gm-Message-State AD7BkJJViDGTAKfGJ/J5Ig/X6FHHuZM0DeUNVaXQOUnj/bvIjuizIUwlDnm67PrV/oV1SUBn/LvVvlEVfuR5qQ==
X-Received by 10.107.135.75 with SMTP id j72mr15362330iod.111.1460216325293; Sat, 09 Apr 2016 08:38:45 -0700 (PDT)
In-Reply-To <CALwzid=nr4FTtt-iQJEG8CwnpbXR-=QctCous0fi0YdC1BP_cA@mail.gmail.com>
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.21
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
X-Mailman-Original-Message-ID <CALwzidkHOTXpKN66n9o-2Y0qaCVZAz=CbX_Vr1C6f12QoXUMnA@mail.gmail.com>
X-Mailman-Original-References <33e44698-2625-47c4-9595-00a8c79f27ad@googlegroups.com> <CALwzid=nr4FTtt-iQJEG8CwnpbXR-=QctCous0fi0YdC1BP_cA@mail.gmail.com>
Xref csiph.com comp.lang.python:106739

Show key headers only | View raw


On Sat, Apr 9, 2016 at 9:14 AM, Ian Kelly <ian.g.kelly@gmail.com> wrote:
> On Fri, Apr 8, 2016 at 5:54 PM, Alexander Myodov <amyodov@gmail.com> wrote:
> This does mean that the pattern for calling aio_map from outside the
> event loop is different from calling it inside the event loop. Your
> main_loop coroutine becomes (note the addition of the "await"):
>
> async def main_loop(loop):
>     results = list(await aio_map(fetch_aio, range(5)))
>     assert(results == [{'aio_arg': '0'}, {'aio_arg': '1'}, {'aio_arg':
> '2'}, {'aio_arg': '3'}, {'aio_arg': '4'}]), results
>     print('Assert ok!')

As a final afterthought, note that the result of asyncio.gather is
already a list, so wrapping it in a list() call here is redundant.

Back to comp.lang.python | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

(Python 3.5) Asyncio and an attempt to run loop.run_until_complete() from within a running loop Alexander Myodov <amyodov@gmail.com> - 2016-04-08 16:54 -0700
  Re: (Python 3.5) Asyncio and an attempt to run loop.run_until_complete() from within a running loop "Frank Millman" <frank@chagford.com> - 2016-04-09 07:08 +0200
  Re: (Python 3.5) Asyncio and an attempt to run loop.run_until_complete() from within a running loop Ian Kelly <ian.g.kelly@gmail.com> - 2016-04-09 09:14 -0600
  Re: (Python 3.5) Asyncio and an attempt to run loop.run_until_complete() from within a running loop Ian Kelly <ian.g.kelly@gmail.com> - 2016-04-09 09:38 -0600

csiph-web