Fix Jupyter support on Windows host

This commit is contained in:
allegroai 2019-06-16 02:29:05 +03:00
parent e452709492
commit 089a4c66ff
2 changed files with 4 additions and 4 deletions

View File

@ -22,14 +22,14 @@ class ScriptInfo(object):
@classmethod
def _get_jupyter_notebook_filename(cls):
if not sys.argv[0].endswith('/ipykernel_launcher.py') or len(sys.argv) < 3 or not sys.argv[2].endswith('.json'):
if not sys.argv[0].endswith(os.path.sep+'ipykernel_launcher.py') or len(sys.argv) < 3 or not sys.argv[2].endswith('.json'):
return None
# we can safely assume that we can import the notebook package here
try:
from notebook.notebookapp import list_running_servers
import requests
current_kernel = sys.argv[2].split('/')[-1].replace('kernel-', '').replace('.json', '')
current_kernel = sys.argv[2].split(os.path.sep)[-1].replace('kernel-', '').replace('.json', '')
server_info = next(list_running_servers())
r = requests.get(
url=server_info['url'] + 'api/sessions',
@ -44,7 +44,7 @@ class ScriptInfo(object):
break
notebook_path = cur_notebook['notebook']['path']
entry_point_filename = notebook_path.split('/')[-1]
entry_point_filename = notebook_path.split(os.path.sep)[-1]
# now we should try to find the actual file
entry_point = (Path.cwd() / entry_point_filename).absolute()

View File

@ -75,7 +75,7 @@ class Logger(object):
self._report_worker = None
self._task_handler = None
if DevWorker.report_stdout and not PrintPatchLogger.patched:
if DevWorker.report_stdout and not PrintPatchLogger.patched and not running_remotely():
Logger._stdout_proxy = PrintPatchLogger(sys.stdout, self, level=logging.INFO)
Logger._stderr_proxy = PrintPatchLogger(sys.stderr, self, level=logging.ERROR)
self._task_handler = TaskHandler(self._task.session, self._task.id, capacity=100)