Skip to content

Commit

Permalink
Do not switch asyncio loop in Jupyter
Browse files Browse the repository at this point in the history
  • Loading branch information
philippjfr committed May 18, 2022
1 parent 1efdb60 commit 7724261
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion panel/io/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -522,11 +522,17 @@ def create_static_handler(prefix, key, app):

# Bokeh 2.4.x patches the asyncio event loop policy but Tornado 6.1
# support the WindowsProactorEventLoopPolicy so we restore it.
try:
JUPYTER_CONTEXT = get_ipython() is not None # noqa
except Exception:
JUPYTER_CONTEXT = False

if (
sys.platform == 'win32' and
sys.version_info[:3] >= (3, 8, 0) and
tornado.version_info >= (6, 1) and
type(asyncio.get_event_loop_policy()) is asyncio.WindowsSelectorEventLoopPolicy
type(asyncio.get_event_loop_policy()) is asyncio.WindowsSelectorEventLoopPolicy and
not JUPYTER_CONTEXT
):
asyncio.set_event_loop_policy(asyncio.WindowsProactorEventLoopPolicy())

Expand Down

0 comments on commit 7724261

Please sign in to comment.