Skip to content

Commit

Permalink
Fix byte/str handling when reading source file and sending to socket (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
justinfx committed Sep 25, 2021
1 parent 77e4c3c commit e54cb23
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions MayaSublime.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ def _sync_settings():
exec({cmd!r}, namespace, namespace)
else:
with open({fp!r}) as _fp:
with open({fp!r}, 'rb') as _fp:
_code = compile(_fp.read(), {fp!r}, 'exec')
exec(_code, namespace, namespace)
Expand Down Expand Up @@ -389,13 +389,15 @@ def _streamToMayaSublime(msg, msgType, *args):
return
try:
_MayaSublime_SOCK.sendto(part, (host, port))
_MayaSublime_SOCK.sendto(_py_str(part), (host, port))
except Exception as e:
if e.errno == errno.EMSGSIZE:
# We have hit a message size limit.
# Scale down and try the packet again
bufsize /= 2
if bufsize < 1:
raise
buf.seek(pos)
continue
# Some other error
Expand Down

0 comments on commit e54cb23

Please sign in to comment.