nbQA-dev / nbQA

Run ruff, isort, pyupgrade, mypy, pylint, flake8, and more on Jupyter Notebooks
https://nbqa.readthedocs.io/en/latest/index.html
MIT License
1.01k stars 39 forks source link

NBQA ruff fails on Windows when the notebook file name has spaces unless `--nbqa-shell` is used #812

Open felix-cw opened 1 year ago

felix-cw commented 1 year ago

I ran the following in a powershell core prompt and git bash in Windows:

nbqa ruff 'nbqa test.ipynb'

The output was as follows:

nbqa:1:1: E902 The system cannot find the file specified. (os error 2)
test62najpm6.py:1:1: E902 The system cannot find the file specified. (os error 2)
Found 2 errors.
error: Failed to lint test62najpm6.py: The system cannot find the file specified. (os error 2)
error: Failed to lint nbqa: The system cannot find the file specified. (os error 2)

I confimed that when the space was removed, the command ran as expected. It also works with black, flake8, isort instead of ruff. I also tried wrapping the file name in double quotes and it still doesn't work.

I can get it to work by adding the --nbqa-shell option. I also confirmed that it works in WSL.

Happy to use --nbqa-shell for now.

MarcoGorelli commented 1 year ago

hi

I'm confused by nbqa ruff 'nbqa test.ipynb' - isn't the way to run it nbqa ruff test.ipynb?

MarcoGorelli commented 1 year ago

ah, the file name is nbqa test.ipynb - OK, thanks for the report