Skip to content

Commit

Permalink
Use sys.getfilesystemencoding() to encode Unicode file names
Browse files Browse the repository at this point in the history
  • Loading branch information
mgeier committed Mar 25, 2015
1 parent ee4a400 commit 7405827
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion soundfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import numpy as _np
import os as _os
import sys as _sys
from cffi import FFI as _FFI
from os import SEEK_SET, SEEK_CUR, SEEK_END

Expand Down Expand Up @@ -681,7 +682,7 @@ def __init__(self, file, mode='r', samplerate=None, channels=None,

self._name = file
if isinstance(file, _unicode):
file = file.encode()
file = file.encode(_sys.getfilesystemencoding())

if isinstance(file, bytes):
if _os.path.isfile(file):
Expand Down

0 comments on commit 7405827

Please sign in to comment.