diff options
author | jaseg <code@jaseg.net> | 2016-08-19 17:54:32 +0200 |
---|---|---|
committer | jaseg <code@jaseg.net> | 2016-08-19 17:54:32 +0200 |
commit | aaddc52da44822ba5d7ceb571c16f4b801612fd7 (patch) | |
tree | 2a01e723f806d6224b859c33ca84b3bb5b597105 | |
parent | ab8b8b54772d06416abf3ae36724b5272cddd59d (diff) | |
download | python-mpv-aaddc52da44822ba5d7ceb571c16f4b801612fd7.tar.gz python-mpv-aaddc52da44822ba5d7ceb571c16f4b801612fd7.tar.bz2 python-mpv-aaddc52da44822ba5d7ceb571c16f4b801612fd7.zip |
Set LC_NUMERIC to C to avoid segfaults on some platforms
-rw-r--r-- | mpv.py | 6 |
1 files changed, 6 insertions, 0 deletions
@@ -14,6 +14,12 @@ if os.name == 'nt': backend = CDLL(ctypes.util.find_library('mpv-1.dll')) fs_enc = 'utf-8' else: + import locale + lc, enc = locale.getlocale(locale.LC_NUMERIC) + # libmpv requires LC_NUMERIC to be set to "C". Since messing with global variables everyone else relies upon is + # still better than segfaulting, we are setting LC_NUMERIC to "C". + locale.setlocale(locale.LC_NUMERIC, 'C') + backend = CDLL(ctypes.util.find_library('mpv')) fs_enc = sys.getfilesystemencoding() |