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


Groups > comp.lang.python > #106721

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 "Frank Millman" <frank@chagford.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 07:08:52 +0200
Lines 20
Message-ID <mailman.107.1460178550.2253.python-list@python.org> (permalink)
References <33e44698-2625-47c4-9595-00a8c79f27ad@googlegroups.com> <nea2pa$d0c$1@ger.gmane.org>
Mime-Version 1.0
Content-Type text/plain; format=flowed; charset="iso-8859-1"; reply-type=original
Content-Transfer-Encoding 7bit
X-Trace news.uni-berlin.de KrAvg4X6Yr6OHuDIK14p6wA9y1ypiQf7JbmKdK9HWYqg==
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.003
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'subject:Python': 0.05; '"if': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'coroutines': 0.16; 'expert,': 0.16; 'help?': 0.16; 'received:80.91.229.3': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'subject:run': 0.16; 'task.': 0.16; 'skip:l 30': 0.18; 'skip:n 60': 0.22; 'wrote': 0.23; 'attach': 0.23; 'header:In-Reply-To:1': 0.24; 'header:X-Complaints-To:1': 0.26; 'handling': 0.27; 'subject:) ': 0.32; 'run': 0.33; 'facility': 0.33; 'advice': 0.35; 'something': 0.35; 'but': 0.36; 'there': 0.36; 'to:addr:python-list': 0.36; 'received:org': 0.37; 'wanted': 0.37; 'does': 0.39; 'subject:from': 0.39; 'to:addr:python.org': 0.40; 'future': 0.60; 'back': 0.62; 'frank': 0.72; 'task,': 0.91
X-Injected-Via-Gmane http://gmane.org/
X-Gmane-NNTP-Posting-Host 197.86.206.120
In-Reply-To <33e44698-2625-47c4-9595-00a8c79f27ad@googlegroups.com>
X-MSMail-Priority Normal
Importance Normal
X-Newsreader Microsoft Windows Live Mail 15.4.3502.922
X-MimeOLE Produced By Microsoft MimeOLE V15.4.3502.922
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 <nea2pa$d0c$1@ger.gmane.org>
X-Mailman-Original-References <33e44698-2625-47c4-9595-00a8c79f27ad@googlegroups.com>
Xref csiph.com comp.lang.python:106721

Show key headers only | View raw


"Alexander Myodov"  wrote in message 
news:33e44698-2625-47c4-9595-00a8c79f27ad@googlegroups.com...

> Hello.

> TLDR: how can I use something like loop.run_until_complete(coro), to 
> execute a coroutine synchronously, while the loop is already running?

I am no expert, but does this help?

"If you're handling coroutines there is an asyncio facility for "background 
tasks".  asyncio.ensure_future() will take a coroutine, attach it to a Task, 
and return a future to you that resolves when the coroutine is complete."

This advice was given to me a while back when I wanted to run a background 
task. It works perfectly for me.

Frank Millman

Back to comp.lang.python | Previous | NextPrevious in thread | Next 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