Skip to content

Commit

Permalink
Add fail message when run without data
Browse files Browse the repository at this point in the history
  • Loading branch information
polm committed Apr 7, 2020
1 parent ddcae47 commit 196616f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions unidic/unidic.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import os
import sys
from wasabi import msg

def get_version(dicdir):
with open(dicdir + '/version') as vfile:
Expand All @@ -10,3 +11,9 @@ def get_version(dicdir):
# This will be used elsewhere to initialize the tagger
DICDIR = os.path.join(_curdir, 'dicdir')
VERSION = get_version(DICDIR)

if VERSION == '0':
msg.fail("You imported unidic, but dicitionary data is not installed. "
"Run this command to install the latest UniDic: "
" python -m unidic download",
exits=1)

0 comments on commit 196616f

Please sign in to comment.