* Fix python3 error

This commit is contained in:
Matthew Honnibal 2015-07-23 14:52:30 +02:00
parent 99387f9572
commit dbda6c27fa
1 changed files with 1 additions and 1 deletions

View File

@ -6,7 +6,7 @@ cdef class CFile:
if isinstance(mode, unicode): if isinstance(mode, unicode):
mode_str = mode.encode('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_str)
if self.fp == NULL: if self.fp == NULL:
raise IOError("Could not open binary file %s" % bytes_loc) raise IOError("Could not open binary file %s" % bytes_loc)
self.is_open = True self.is_open = True