Skip to content

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

@lt7

Description

@lt7

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:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions