8000 Initial commit. · matplotlib/matplotlib@f9da422 · GitHub
[go: up one dir, main page]

Skip to content

Commit f9da422

Browse files
author
zhizheng1
authored
Initial commit.
1 parent 4965500 commit f9da422

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

lib/matplotlib/backends/backend_webagg.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,14 @@ def random_ports(port, n):
245245

246246
@classmethod
247247
def start(cls):
248+
try:
249+
import asyncio
250+
asyncio.get_running_loop()
251+
except:
252+
pass
253+
else:
254+
cls.started = True
255+
248256
if cls.started:
249257
return
250258

@@ -283,11 +291,16 @@ def catch_sigint():
283291

284292

285293
def ipython_inline_display(figure):
294+
286295
import tornado.template
287296

288297
WebAggApplication.initialize()
289-
if not webagg_server_thread.is_alive():
290-
webagg_server_thread.start()
298+
try:
299+
import asyncio
300+
asyncio.get_running_loop()
301+
except:
302+
if not webagg_server_thread.is_alive():
303+
webagg_server_thread.start()
291304

292305
fignum = figure.number
293306
tpl = Path(core.FigureManagerWebAgg.get_static_file_path(),

0 commit comments

Comments
 (0)
0