Good afternoon!
I'm trying to set up a pre-commit to check the .ipynb file.
It works nbqa flake8 --ignore=E402,W291,W293 --max-line-length=120 --show-source Project.ipynb
in command line, the same thing done with
.pre-commit-config.yaml:
repos:
- repo: https://github.com/nbQA-dev/nbQA
rev: 1.7.0
hooks:
- id: nbqa-flake8
args: ['--ignore="E402,W291,W293', '--max-line-length=120', '--show-source', '--output-file=output.txt']
or configuration file:
[flake8]
extend-ignore = E402,W291,W293
max-line-length= 120
show_source = True
statistics = True
does not work.
C:\Users\yesno\.cache\pre-commit\repoxlk1smrm\py_env-python3.11\Lib\site-packages\autopep8.py:182: DeprecationWarning: lib2to3 package is deprecated and may not be able to parse Python 3.10+
from lib2to3.pgen2 import tokenize as lib2to3_tokenize
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "C:\Users\yesno\.cache\pre-commit\repoxlk1smrm\py_env-python3.11\Scripts\nbqa.EXE\__main__.py", line 7, in <module>
File "C:\Users\yesno\.cache\pre-commit\repoxlk1smrm\py_env-python3.11\Lib\site-packages\nbqa\__main__.py", line 875, in main
return _main(cli_args, configs)
^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\yesno\.cache\pre-commit\repoxlk1smrm\py_env-python3.11\Lib\site-packages\nbqa\__main__.py", line 784, in _main
sys.stdout.write(output.out)
File "C:\Users\yesno\AppData\Local\Programs\Python\Python311\Lib\encodings\cp1252.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_table)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeEncodeError: 'charmap' codec can't encode characters in position 2135-2141: character maps to <undefined>
I tried to do this from:
- the command line (work)
- pass the parameters in .pre-commit-config.yaml (work without --show-source)
- pass the parameters in the configuration file. (work without --show-source)
The error is very similar to this one: https://github.com/pycqa/flake8/issues/1381
What can I do to fix this?