Skip to content

Commit

Permalink
Make utf-8 file open backwards compatible for py2 (#40)
Browse files Browse the repository at this point in the history
  • Loading branch information
justinfx committed Sep 29, 2021
1 parent a3d76f3 commit fda023f
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
8 changes: 7 additions & 1 deletion MayaSublime.py
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,12 @@ def _sync_settings():
import maya.cmds
def _open(f):
try:
return open(f, encoding='utf-8')
except TypeError:
return open(f)
namespace = __main__.__dict__.get('_sublime_SendToMaya_plugin')
if not namespace:
namespace = __main__.__dict__.copy()
Expand All @@ -289,7 +295,7 @@ def _sync_settings():
exec({cmd!r}, namespace, namespace)
else:
with open({fp!r}, encoding='utf-8') as _fp:
with _open({fp!r}) as _fp:
_code = compile(_fp.read(), {fp!r}, 'exec')
exec(_code, namespace, namespace)
Expand Down
3 changes: 2 additions & 1 deletion messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
"3.0.3": "messages/3.0.3.md",
"3.0.4": "messages/3.0.4.md",
"3.1.0": "messages/3.1.0.md",
"3.1.1": "messages/3.1.1.md"
"3.1.1": "messages/3.1.1.md",
"3.1.2": "messages/3.1.2.md"
}
3 changes: 3 additions & 0 deletions messages/3.1.2.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
MayaSublime 3.1.2 change log:

- [#40]: Make utf-8 file open fix backwards compatible with python 2.x

0 comments on commit fda023f

Please sign in to comment.