justinfx / MayaSublime

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

sending file to maya execute in chinese version problem! #38

Closed tuqubao closed 2 years ago

tuqubao commented 2 years ago
# 你好,这是一个测试。

print('你好,这是一个测试。')

above the code in sublime text in python. when key enter+ctrl send the file to maya executed. will be a error .

# Traceback (most recent call last):
#   File "<string>", line 25, in <module>
# UnicodeDecodeError: 'gbk' codec can't decode byte 0xaf in position 18: illegal multibyte sequence

but when selected the code to send to maya executed, then is on problem.

i will email a test code for you.

justinfx commented 2 years ago

@tuqubao I still wasn't able to reproduce the exact failure, probably because of a difference between our system encoding types. But I did try to apply some fixes to where the source file was being read. I'm hoping reading it in as binary and letting python figure it out would be enough.

Are you able to test the 38_py3_encoding branch, or do I have to fully release another version before you can try it?

tuqubao commented 2 years ago

ok. l will do a test.

--------------原始邮件-------------- 发件人:"Justin Israel @.>; 发送时间:2021年9月26日(星期天) 凌晨5:02 收件人:"justinfx/MayaSublime" @.>; 抄送:"tuqubao @.>;"Mention @.>; 主题:Re: [justinfx/MayaSublime] sending file to maya execute in chinese version problem! (#38)

@tuqubao I still wasn't able to reproduce the exact failure, probably because of a difference between our system encoding types. But I did try to apply some fixes to where the source file was being read. I'm hoping reading it in as binary and letting python figure it out would be enough.

Are you able to test the 38_py3_encoding branch, or do I have to fully release another version before you can try it?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

tuqubao commented 2 years ago

have you try to add coding in file open()? encoding='utf-8' open(,,encoding='utf-8') I find some tip to solve the problem like this in Chinese web page saying. mybe add the code will ok to run chinese file.

tuqubao commented 2 years ago

l reinstall the new version the problem still exists.

justinfx commented 2 years ago

@tuqubao can you try changing this line and testing? https://github.com/justinfx/MayaSublime/blob/38_py3_encoding/MayaSublime.py#L292 It was supposed to work fine using a binary read, which is why I added 'rb'

Try this:

with open({fp!r}, encoding='utf-8') as _fp:
tuqubao commented 2 years ago

can you release a new version and i reinstall to test

tuqubao commented 2 years ago

manual install is difficulty to me.

justinfx commented 2 years ago

@tuqubao I don't really enjoy this workflow, doing a full release just to allow you to test the changes. It notifies users that there was an update, only so you can try and test if it fixed your particular issue. Are you not able to clone this branch into your SublimeText package location?

tuqubao commented 2 years ago

ok, now i am try it.

tuqubao commented 2 years ago

when i modify the code. with open({fp!r}, encoding='utf-8') as _fp: thing is ok. it work fine. thank you!

tuqubao commented 2 years ago

have you release a new version about modify this ?

tuqubao commented 2 years ago

this is my modify:

   this is my execution:

thing is work fine, thank you for those day to help me.  where to pay some money for you help?

------------------ Original ------------------ From:  "Justin @.>; Date:  Mon, Sep 27, 2021 03:05 AM To: @.>; Cc: @.>; @.>; Subject:  Re: [justinfx/MayaSublime] sending file to maya execute in chinese version problem! (#38)

 

@tuqubao I don't really enjoy this workflow, doing a full release just to allow you to test the changes. It notifies users that there was an update, only so you can try and test if it fixed your particular issue. Are you not able to clone this branch into your SublimeText package location?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe. Triage notifications on the go with GitHub Mobile for iOS or Android.

justinfx commented 2 years ago

Thanks for testing the fix. I have published 3.1.1. It takes up to a day for Sublime Package Manager to sync the release.