From 2a72bc5f0e5fb25e8955e773cbdc87997257569b Mon Sep 17 00:00:00 2001 From: Nitin Madnani Date: Wed, 28 Oct 2020 19:44:17 -0400 Subject: [PATCH] Include asyncio + Python38 + Windows workaround --- rsmtool/reporter.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/rsmtool/reporter.py b/rsmtool/reporter.py index 50a36f6d7..fded4b81f 100644 --- a/rsmtool/reporter.py +++ b/rsmtool/reporter.py @@ -9,9 +9,11 @@ """ import argparse +import asyncio import logging import json import os +import sys from os.path import (abspath, basename, @@ -317,6 +319,15 @@ def convert_ipynb_to_html(notebook_file, html_file): :ref:`render_notebook ` command-line utility. """ + # `nbconvert` uses `asyncio` which uses an entirely default + # implemention of the event loop on Windows for Cpython 3.8 + # which breaks the report generation unless we include the + # following workaround + if (sys.version_info[0] == 3 and + sys.version_info[1] >= 8 and + sys.platform.startswith('win')): + asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy()) + # set a high timeout for datasets with a large number of features report_config = Config({'ExecutePreprocessor': {'enabled': True, 'timeout': 3600},