1

I followed the instructions on this website to setup Black on my PyCharm (I followed the Windows steps). I have set it to run on every save and I already have a keybinding set for it as well. When I run this, it gives me the following error:

error: cannot format path\to\python\program.py: module 'blib2to3.pygram' has no attribute 'python_grammar_no_print_statement_no_exec_statement_async_keywords'
Oh no! \U0001f4a5 \U0001f494 \U0001f4a5
1 file failed to reformat.

What can I do about this?

bad_coder
  • 11,289
  • 20
  • 44
  • 72
arpanet101
  • 183
  • 1
  • 11
  • 1
    From the length of those Unicode points (e.g. `\U0001f4a5`) I'd venture to say your module has some [UTF-16](https://en.wikipedia.org/wiki/UTF-16#Code_points_from_U+010000_to_U+10FFFF) in it. Since the problem is "cannot format path" is there any chance the directory/file name has UTF-16 length characters in it and black can't convert them properly? (Also consider checking the name of the venv path where you installed black). – bad_coder Nov 29 '21 at 22:49

0 Answers0