Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"lean encrypt" does not work with Chinese comment #493

Closed
pizikuan opened this issue Aug 27, 2024 · 4 comments · Fixed by #496
Closed

"lean encrypt" does not work with Chinese comment #493

pizikuan opened this issue Aug 27, 2024 · 4 comments · Fixed by #496
Assignees
Labels
bug Something isn't working

Comments

@pizikuan
Copy link

lean encrypt xxxxx --key "D:\Backup\quantconnect_encryt.txt"

Error: Could not encrypt project D:\Work\QuantConnect\xstrategy: Failed to encrypt file
D:\Work\QuantConnect\xxxxx\base.py with error 'gbk' codec can't decode byte 0xa1 in position 523: illegal
multibyte sequence

lean encrypt does not work with Chinese comment. "position 523" is the first Chinese character in this file with UTF8 encoding.

@Martin-Molinero Martin-Molinero added the bug Something isn't working label Aug 27, 2024
@Marinovsky
Copy link
Collaborator

Hey @pizikuan !

Could you please share a file with the portion of base.py that has the characters producing this exception? So far we've been able to reproduce a similar but not the same exception, namely: charmap' codec can't decode byte 0x8d in position 78: character maps to <undefined>. It would be also useful if you could share with us the logs when you run that same command with --verbose

@pizikuan
Copy link
Author

pizikuan commented Sep 9, 2024

import json
import logging
import sys

class MyConfig:
DEBUG = True # 调试模式,会打印出更多的log

@Marinovsky
Copy link
Collaborator

Hey @pizikuan !

I tested in my local (using the latest version of lean-cli) the encrypt command with a file containing that portion of code you provided and it worked (both encrypt and decrypt, using both UTF-8 and GB2312 encodings). Could you please retry encrypting the project that was failing using the latest version of lean-cli?

@pizikuan
Copy link
Author

pizikuan commented Sep 10, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants