dnanhkhoa / nb_black

A simple extension for Jupyter Notebook and Jupyter Lab to beautify Python code automatically using black.
MIT License
368 stars 41 forks source link

ERROR:root:__call__() missing 1 required positional argument: 'value' #22

Open Yuan-Meng opened 4 years ago

Yuan-Meng commented 4 years ago

When I ran %reload_ext lab_black in my Jupyterlab, I got an error message:

ERROR:root:__call__() missing 1 required positional argument: 'value'
Traceback (most recent call last):
  File "/opt/anaconda3/lib/python3.7/site-packages/lab_black.py", line 218, in format_cell
    formatted_code = _format_code(cell)
  File "/opt/anaconda3/lib/python3.7/site-packages/lab_black.py", line 29, in _format_code
    return format_str(src_contents=code, mode=FileMode())
TypeError: __call__() missing 1 required positional argument: 'value'
Screen Shot 2020-04-11 at 6 15 39 PM

Here's line 29:

Screen Shot 2020-04-11 at 6 22 19 PM

Here's line 218:

Screen Shot 2020-04-11 at 6 22 28 PM

Which function misses what argument? Also, I just updated to Jupyterlab to 2.1.0 so I don't know if there are weird incompatibility issues. Did anyone encounter this? Thanks!!

ashwinidathatri commented 4 years ago

I have been receiving the same error as well. I doubt if it has anything to do with compatibility of the version. Anyway currently I am using JupyterLab version 1.2.16

Any suggestions on this would be helpful.

terhorst commented 4 years ago

This is caused by having an old version of black. pip install -U black fixed it for me. To the maintainers: I don't know when black changed the API for FileMode() but moving from version 18.6b4 to 19.10b0 made this error go away.