Python Forum

Full Version: RuntimeError: This event loop is already running
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello everyone,

I have just installed Anaconda 5.3.1 on Windows 10 selecting Python 3.7 version, I use Spyder (python 3.6) and I want to run the module VPython:

http://vpython.org/

This is the code I want to execute:

import vpython as visual
from visual.graph import *                                    # Import Visual

graph1 = gdisplay(width=500,height=300)
Plot1 =  gcurve(color=color.white)                            # gcurve method
graph2 = gdisplay(x=500,width=600,height=450, title="Visual plot", xtitle='x',
        ytitle='f(x)', foreground=color.black, background=color.white)
Plot2 = gdots(color=color.green)

for x in arange(0,8.1,0.1):     Plot1.plot(pos=(x,5*cos(2*x)*exp(-0.4*x)))         

Plot2 = gdots(color=color.green)

for x in arange(-5,5.0,0.1):    Plot2.plot(pos=(x,cos(x)))
And this is what happens:

-A navigator (Chrome or Explorer) is opened and tries to enter the url http://localhost:58627/ but the navigator is empty I cannot see anything.

-On the kernel of Spyder I get these messages:

Python 3.6.5 |Anaconda, Inc.| (default, Mar 29 2018, 13:32:41) [MSC v.1900 64 bit (AMD64)]
Type "copyright", "credits" or "license" for more information.

IPython 6.4.0 -- An enhanced Interactive Python.

Reiniciando el nĂșcleo...




In [1]: runfile('C:/Users/Santi/.spyder-py3/temp.py', wdir='C:/Users/Santi/.spyder-py3')
Traceback (most recent call last):

File "<ipython-input-1-236c810b3032>", line 1, in <module>
runfile('C:/Users/Santi/.spyder-py3/temp.py', wdir='C:/Users/Santi/.spyder-py3')

File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\lib\site-packages\spyder\utils\site\sitecustomize.py", line 705, in runfile
execfile(filename, namespace)

File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile
exec(compile(f.read(), filename, 'exec'), namespace)

File "C:/Users/Santi/.spyder-py3/temp.py", line 3, in <module>
import vpython as visual

File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\lib\site-packages\vpython\__init__.py", line 40, in <module>
from .no_notebook import *

File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\lib\site-packages\vpython\no_notebook.py", line 186, in <module>
__interact_loop.run_until_complete(__coro)

File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\lib\asyncio\base_events.py", line 455, in run_until_complete
self.run_forever()

File "C:\Program Files (x86)\Microsoft Visual Studio\Shared\Anaconda3_64\lib\asyncio\base_events.py", line 409, in run_forever
raise RuntimeError('This event loop is already running')

RuntimeError: This event loop is already running


In [2]:

In [2]:




---------------------------------------
I think VPython is properly installed and imported because I don't get "no visual package found" but Why do I get this loop error?

Thanks for your time!
any ideas?
Hello

I have the same issue. Did you fix it?