Skip to content

Commit

Permalink
Possible solution to explosion#909
Browse files Browse the repository at this point in the history
  • Loading branch information
solresol committed Mar 25, 2017
1 parent f40fbc3 commit b7f714b
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion spacy/cli/link.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from pathlib import Path
import importlib
from .. import util
import sys


def link(origin, link_name, force=False):
Expand Down Expand Up @@ -43,7 +44,13 @@ def symlink(model_path, link_name, force):
elif link_path.exists():
link_path.unlink()

link_path.symlink_to(model_path)
if sys.version.startswith('2.') and sys.platform.startswith('win'):
import subprocess
subprocess.call(['mklink','/d',str(link_path), str(model_path)],
shell=True)
else:
link_path.symlink_to(model_path)

util.print_msg(
"{a} --> {b}".format(a=model_path.as_posix(), b=link_path.as_posix()),
"You can now load the model via spacy.load('{l}').".format(l=link_name),
Expand Down

0 comments on commit b7f714b

Please sign in to comment.