From ac6b6122ff06a4dd9595b0c8b800bd3e4202cb07 Mon Sep 17 00:00:00 2001 From: Andrew Therriault Date: Mon, 17 Aug 2015 00:44:56 -0400 Subject: [PATCH 1/2] Fix symlink issue with Win/Py2 Addresses issue #302 by adding check for symlink before attempting to use. If not there, sets symlink parameter to False. --- notebook/nbextensions.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/notebook/nbextensions.py b/notebook/nbextensions.py index dc1ffecdc..2e660018f 100644 --- a/notebook/nbextensions.py +++ b/notebook/nbextensions.py @@ -148,6 +148,10 @@ def install_nbextension(path, overwrite=False, symlink=False, user=False, prefix # make sure nbextensions dir exists ensure_dir_exists(nbext) + # forcing symlink parameter to False if os.symlink does not exist (e.g., on Windows machines running python 2) + if 'symlink' not in dir(os): + symlink = False + if isinstance(path, (list, tuple)): raise TypeError("path must be a string pointing to a single extension to install; call this function multiple times to install multiple extensions") From d16576eb683d1761b079615768657b63d78047ba Mon Sep 17 00:00:00 2001 From: Matthias Bussonnier Date: Thu, 3 Sep 2015 11:47:26 +0200 Subject: [PATCH 2/2] Use more pythonic way to check wether module have attribute closes #303 --- notebook/nbextensions.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/notebook/nbextensions.py b/notebook/nbextensions.py index 2e660018f..de4073346 100644 --- a/notebook/nbextensions.py +++ b/notebook/nbextensions.py @@ -149,7 +149,7 @@ def install_nbextension(path, overwrite=False, symlink=False, user=False, prefix ensure_dir_exists(nbext) # forcing symlink parameter to False if os.symlink does not exist (e.g., on Windows machines running python 2) - if 'symlink' not in dir(os): + if not hasattr(os, 'symlink'): symlink = False if isinstance(path, (list, tuple)):