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

detect-wallet-private-key pre-commit fails on windows due to lack of utf-8 #1

Open
lt7 opened this issue Jul 19, 2022 · 0 comments
Open

Comments

@lt7
Copy link

lt7 commented Jul 19, 2022

Attempting to commit using latest development branch/v1.6.0 on Windows11 and get the following error from pre-commit hook.

18:07:41.942: [hummingbot] git -c credential.helper= -c core.quotepath=false -c log.showSignature=false commit -F C:\Users\joe\AppData\Local\Temp\git-commit-msg-.txt --
Flake8...................................................................Passed
Detect Private Key.......................................................Passed
eslint...............................................(no files to check)Skipped
Detect Wallet Private Keys...............................................Failed
- hook id: detect-wallet-private-key
- exit code: 1
Traceback (most recent call last):
  File "c:\users\joe\.conda\envs\hummingbot\lib\runpy.py", line 193, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "c:\users\joe\.conda\envs\hummingbot\lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\joe\.cache\pre-commit\repostte_z3p\py_env-default\Scripts\detect-wallet-private-key.EXE\__main__.py", line 7, in <module>
  File "C:\Users\joe\.cache\pre-commit\repostte_z3p\py_env-default\lib\site-packages\hooks\detect_wallet_private_key.py", line 21, in main
    lines = f.readlines()
  File "c:\users\joe\.conda\envs\hummingbot\lib\encodings\cp1252.py", line 23, in decode
    return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 5850: character maps to <undefined>
isort....................................................................Passed

with open(filename, 'r') as f:
this line needs to handle utf-8 something like below perhaps, added it and it worked.

with open(filename, 'r',  encoding="utf8") as f:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant