title: "RuntimeError: asyncio.run() cannot be called from a running event loop" in Spyder
body: <p>I am trying to learn about asyncio for a websockets client. Every piece of code I try gets the following error:</p>
  
  <blockquote>
    <p>RuntimeError: asyncio.run() cannot be called from a running event loop</p>
  </blockquote>
  
  <p>I have tried the most simple code and it always gives that RuntimeError. I tried installing the full anaconda distribution again, etc, and can´t find what the problem might be.</p>
  
  <p>I am using Spyder 3.3.3 with Python 3.7.3</p>
  
  <p>An example of code that should work:</p>
  
  <pre class="lang-py prettyprint-override"><code>import asyncio
  
  async def main():
      print('hello')
      await asyncio.sleep(1)
      print('world')
  
  asyncio.run(main())
  </code></pre>
  
  <p>Error message:</p>
  
  <pre class="lang-none prettyprint-override"><code>File "C:\Users\jmart\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 786, in runfile
    execfile(filename, namespace)
  File "C:\Users\jmart\Anaconda3\lib\site-packages\spyder_kernels\customize\spydercustomize.py", line 110, in execfile
    exec(compile(f.read(), filename, 'exec'), namespace)
  File "C:/Users/jmart/Documents/asynk2.py", line 8, in &lt;module&gt;
    asyncio.run(main())
  File "C:\Users\jmart\Anaconda3\lib\asyncio\runners.py", line 34, in run
    "asyncio.run() cannot be called from a running event loop")
  RuntimeError: asyncio.run() cannot be called from a running event loop
  </code></pre>