Skip to content

Commit

Permalink
More detailed loading error message
Browse files Browse the repository at this point in the history
  • Loading branch information
vchahun committed Apr 16, 2013
1 parent abb1290 commit 8791fa7
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 16 deletions.
44 changes: 29 additions & 15 deletions python/kenlm.cpp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion python/kenlm.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ cdef class LanguageModel:
try:
self.model = new Model(self.path)
except RuntimeError as exception:
raise IOError('Cannot read model \'%s\'' % path) from exception
exception_message = str(exception_message).replace('\n', ' ')
raise IOError('Cannot read model \'{}\' ({})'.format(path, exception_message))\
from exception
self.vocab = &self.model.GetVocabulary()

def __dealloc__(self):
Expand Down

0 comments on commit 8791fa7

Please sign in to comment.