mirror of
https://github.com/explosion/spaCy.git
synced 2025-01-12 18:26:30 +03:00
* Fix CFile for Python2
This commit is contained in:
parent
8e800adfbc
commit
3fe14b8ed6
|
@ -5,6 +5,8 @@ cdef class CFile:
|
|||
def __init__(self, loc, mode):
|
||||
if isinstance(mode, unicode):
|
||||
mode_str = mode.encode('ascii')
|
||||
else:
|
||||
mode_str = mode
|
||||
cdef bytes bytes_loc = loc.encode('utf8') if type(loc) == unicode else loc
|
||||
self.fp = fopen(<char*>bytes_loc, mode_str)
|
||||
if self.fp == NULL:
|
||||
|
|
Loading…
Reference in New Issue
Block a user