Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
Fairseq
Commits
dcbf5e75
Commit
dcbf5e75
authored
Dec 26, 2017
by
Myle Ott
Browse files
Raise FileNotFoundError if dictionary files don't exist
parent
fa508492
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
0 deletions
+2
-0
fairseq/dictionary.py
fairseq/dictionary.py
+2
-0
No files found.
fairseq/dictionary.py
View file @
dcbf5e75
...
@@ -113,6 +113,8 @@ class Dictionary(object):
...
@@ -113,6 +113,8 @@ class Dictionary(object):
try
:
try
:
with
open
(
f
,
'r'
,
encoding
=
'utf-8'
)
as
fd
:
with
open
(
f
,
'r'
,
encoding
=
'utf-8'
)
as
fd
:
return
Dictionary
.
load
(
fd
)
return
Dictionary
.
load
(
fd
)
except
FileNotFoundError
as
fnfe
:
raise
fnfe
except
:
except
:
raise
Exception
(
"Incorrect encoding detected in {}, please "
raise
Exception
(
"Incorrect encoding detected in {}, please "
"rebuild the dataset"
.
format
(
f
))
"rebuild the dataset"
.
format
(
f
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment