I added a magic header:
# -*- coding: utf-8 -*-
No change in the results.
Input file is created by intelliJ IDEA 2023.2.2.
Several files give the same error.
I see comments suggesting that utf-8 is standard encoding and trusted that intelliJ IDEA 2023.2.2 would mind the standard.
I removed the --diff
tag, but still got the same results.
I'm on Windows 11, with Python 3.11.
I get this traceback:
E:\python\Projects\p2>python -m black --diff settings.pyTraceback (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\dickr\AppData\Roaming\Python\Python311\site-packages\black\__main__.py", line 3, in <module> patched_main() File "src\black\__init__.py", line 1602, in patched_main File "C:\Users\dickr\AppData\Roaming\Python\Python311\site-packages\click\core.py", line 1157, in __call__ return self.main(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\dickr\AppData\Roaming\Python\Python311\site-packages\click\core.py", line 1078, in main rv = self.invoke(ctx) ^^^^^^^^^^^^^^^^ File "C:\Users\dickr\AppData\Roaming\Python\Python311\site-packages\click\core.py", line 1434, in invoke return ctx.invoke(self.callback, **ctx.params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\dickr\AppData\Roaming\Python\Python311\site-packages\click\core.py", line 783, in invoke return __callback(*args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\dickr\AppData\Roaming\Python\Python311\site-packages\click\decorators.py", line 33, in new_func return f(get_current_context(), *args, **kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "src\black\__init__.py", line 668, in main File "src\black\__init__.py", line 744, in get_sources File "C:\Users\dickr\AppData\Roaming\Python\Python311\site-packages\black\files.py", line 254, in get_gitignore lines = gf.readlines() ^^^^^^^^^^^^^^ File "<frozen codecs>", line 322, in decodeUnicodeDecodeError: 'utf-8' codec can't decode byte 0xd2 in position 16: invalid continuation byte
I've searched black documentation for an option to change encoding with no luck.