Fix python 2 on linux.

This commit is contained in:
Quantum 2018-08-22 17:42:34 -04:00
parent 2705dff909
commit 2baeaa5752
3 changed files with 3 additions and 3 deletions

View file

@ -272,7 +272,7 @@ def load_model(path):
if not os.path.isabs(path):
path = os.path.join(model_base, path)
if not isinstance(path, unicode):
path = path.decode('mbcs')
path = path.decode('mbcs' if os.name == 'nt' else 'utf8')
return WavefrontObject(path)
@cython.nonecheck(False)

View file

@ -247,7 +247,7 @@ class Applet(pyglet.window.Window):
with os.fdopen(fd, 'wb') as file:
image.save(file, 'BMP')
if isinstance(filename, six.binary_type):
filename = filename.decode('mbcs')
filename = filename.decode('mbcs' if os.name == 'nt' else 'utf8')
image = windll.user32.LoadImageW(None, filename, 0, 0, 0, 0x10)
windll.user32.OpenClipboard(self._hwnd)
windll.user32.EmptyClipboard()

View file

@ -241,7 +241,7 @@ def load_model(path):
if not os.path.isabs(path):
path = os.path.join(model_base, path)
if isinstance(path, six.binary_type):
path = path.decode('mbcs')
path = path.decode('mbcs' if os.name == 'nt' else 'utf8')
return WavefrontObject(path)