mirror of https://github.com/explosion/spaCy.git
* Fix python3 error
This commit is contained in:
parent
b81ffe9032
commit
99387f9572
|
@ -4,7 +4,7 @@ from libc.stdio cimport fopen, fclose, fread, fwrite, FILE
|
||||||
cdef class CFile:
|
cdef class CFile:
|
||||||
def __init__(self, loc, mode):
|
def __init__(self, loc, mode):
|
||||||
if isinstance(mode, unicode):
|
if isinstance(mode, unicode):
|
||||||
mode_str = mode.decode('ascii')
|
mode_str = mode.encode('ascii')
|
||||||
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, mode)
|
self.fp = fopen(<char*>bytes_loc, mode)
|
||||||
if self.fp == NULL:
|
if self.fp == NULL:
|
||||||
|
|
Loading…
Reference in New Issue