Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fresh install still has writing grammar bug #3075

Closed
michaelaye opened this issue May 17, 2022 · 1 comment · Fixed by #3193
Closed

Fresh install still has writing grammar bug #3075

michaelaye opened this issue May 17, 2022 · 1 comment · Fixed by #3193
Labels
T: bug Something isn't working

Comments

@michaelaye
Copy link

Describe the bug

A fresh conda env with minimal install of

  • black
  • jupyterlab
  • jupyterlab_code_formatter

still shows the long known (#2681 , #1143) "Writing grammar tables.... Writing failed" bug:

Generating grammar tables from /home/maye/mambaforge/envs/black_bug/lib/python3.10/site-packages/blib2to3/Grammar.txt
Writing grammar tables to /home/maye/.cache/black/22.3.0/Grammar3.10.4.final.0.pickle
Writing failed: [Errno 2] No such file or directory: '/home/maye/.cache/black/22.3.0/tmp6pup1qkm'
Generating grammar tables from /home/maye/mambaforge/envs/black_bug/lib/python3.10/site-packages/blib2to3/PatternGrammar.txt
Writing grammar tables to /home/maye/.cache/black/22.3.0/PatternGrammar3.10.4.final.0.pickle
Writing failed: [Errno 2] No such file or directory: '/home/maye/.cache/black/22.3.0/tmp95bkx21m'

To Reproduce

conda create -n black_bug python=3.10 -c conda-forge
conda activate black_bug
mamba install jupyterlab black jupyterlab_code_formatter

Launch jlab with jupyterlab

Open a notebook, put some code to format in.
Activate "Format cell" via context menu.
See error in terminal log

Expected behavior

That the required subfolder for the black version is created before writing into it is tried.

Environment

  • Black's version: 22.3.0 (compiled: no)
  • OS and Python version: Linux, Python 3.10 via conda
@michaelaye michaelaye added the T: bug Something isn't working label May 17, 2022
@fbfokus
Copy link

fbfokus commented May 18, 2022

I receive the same bug when starting jupyter lab:

Generating grammar tables from /opt/conda/lib/python3.8/site-packages/blib2to3/Grammar.txt
Writing grammar tables to /root/.cache/black/22.3.0/Grammar3.8.8.final.0.pickle
Writing failed: [Errno 2] No such file or directory: '/root/.cache/black/22.3.0/tmp5v0nw2kn'
Generating grammar tables from /opt/conda/lib/python3.8/site-packages/blib2to3/PatternGrammar.txt
Writing grammar tables to /root/.cache/black/22.3.0/PatternGrammar3.8.8.final.0.pickle
Writing failed: [Errno 2] No such file or directory: '/root/.cache/black/22.3.0/tmpzuzu9a0f'

My requirements.txt looks like this:

ipython==8.3.0
Jinja2==3.1.2
pydantic==1.8.0
jupyter==1.0.0
jupyterlab==3.4.0
jedi-language-server==0.36.0
jupyterlab-lsp==3.10.1
python-lsp-server[all]==1.4.1
jupyterlab-code-formatter==1.4.11
jupyterlab-git==0.37.1
git+https://github.com/twalcari/jupyterlab_tensorboard.git
black==22.3.0
isort==5.10.1
traitlets==5.2.1.post0
jedi==0.18.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants