mirror of https://github.com/explosion/spaCy.git
Errors.E146 for IO error when FP is null
This commit is contained in:
parent
5d544f89ba
commit
b1911f7105
|
@ -408,6 +408,7 @@ class Errors(object):
|
||||||
E143 = ("Labels for component '{name}' not initialized. Did you forget to call add_label()?")
|
E143 = ("Labels for component '{name}' not initialized. Did you forget to call add_label()?")
|
||||||
E144 = ("Could not find parameter `{param}` when building the entity linker model.")
|
E144 = ("Could not find parameter `{param}` when building the entity linker model.")
|
||||||
E145 = ("Error reading `{param}` from input file.")
|
E145 = ("Error reading `{param}` from input file.")
|
||||||
|
E146 = ("Could not access `{path}`.")
|
||||||
|
|
||||||
|
|
||||||
@add_codes
|
@add_codes
|
||||||
|
|
|
@ -372,7 +372,8 @@ cdef class Writer:
|
||||||
loc = bytes(loc)
|
loc = bytes(loc)
|
||||||
cdef bytes bytes_loc = loc.encode('utf8') if type(loc) == unicode else loc
|
cdef bytes bytes_loc = loc.encode('utf8') if type(loc) == unicode else loc
|
||||||
self._fp = fopen(<char*>bytes_loc, 'wb')
|
self._fp = fopen(<char*>bytes_loc, 'wb')
|
||||||
assert self._fp != NULL, "Could not access %s" % loc
|
if not self._fp:
|
||||||
|
raise IOError(Errors.E146.format(path=loc))
|
||||||
fseek(self._fp, 0, 0)
|
fseek(self._fp, 0, 0)
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
|
|
Loading…
Reference in New Issue