justinfx / MayaSublime

Send selected Python and MEL code snippets from SublimeText to Maya via commandPort
MIT License
149 stars 38 forks source link

Encoding Error ST3 and ST4 #40

Closed JokerMartini closed 3 years ago

JokerMartini commented 3 years ago

For whatever reason in both versions of ST3 and ST4 whenever i try to send a command to maya using the Send File command i get this error:

#   File "<string>", line 24, in <module>
# TypeError: 'encoding' is an invalid keyword argument for this function

However if i select all the text and 'send selected text' instead of 'send file' i don't get the error. What is happening here and why? How can this be fixed?

JokerMartini commented 3 years ago

Was there a recent update regarding encoding of some sort. We can no longer send 'file's to maya. Only selected text which is quite annoying. I'm sure I'm just missing something simple here.

JokerMartini commented 3 years ago

I added a fix to your commit that breaks sublime text for maya

else:
    try:
        with open({fp!r}) as _fp:
            _code = compile(_fp.read(), {fp!r}, 'exec')
            exec(_code, namespace, namespace)
    except:
        with open({fp!r}, encoding='utf-8') as _fp:
            _code = compile(_fp.read(), {fp!r}, 'exec')
            exec(_code, namespace, namespace)   
justinfx commented 3 years ago

@JokerMartini can you give the master branch a test again?

JokerMartini commented 3 years ago

Sure lll try it now

JokerMartini commented 3 years ago

All is fixed and working now. Thanks Justin!

justinfx commented 3 years ago

Thanks! I've released v3.1.2 https://github.com/justinfx/MayaSublime/releases/tag/3.1.2