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

Finds no python files to format #458

Closed
traits opened this issue Feb 10, 2024 · 2 comments
Closed

Finds no python files to format #458

traits opened this issue Feb 10, 2024 · 2 comments
Labels
triage-needed Issue is not triaged.

Comments

@traits
Copy link

traits commented Feb 10, 2024

System Win10, Python version see below, black ==24.1.1 is installed (error happens with all versions - bundled or not):

2024-02-10 22:41:22.112 [info] v:\bin\scripting\python\current\python-3.10.5.amd64\python.exe -m black --stdin-filename v:\my\invoice\src\main.py -
2024-02-10 22:41:22.112 [info] CWD formatter: v:\my\invoice
2024-02-10 22:41:22.117 [info] No Python files are present to be formatted. Nothing to do 😴

But there is a file and it is known: main.py. So, what?

More verbose output (What is the meaning of the server error?):

2024-02-11 11:12:43.775 [info] [Trace - 11:12:43 AM] Sending notification 'textDocument/didChange'.
2024-02-11 11:12:46.234 [info] [Trace - 11:12:46 AM] Sending request 'textDocument/formatting - (1)'.
2024-02-11 11:12:46.241 [info] [Trace - 11:12:46 AM] Received notification 'window/logMessage'.
2024-02-11 11:12:46.241 [info] v:\bin\scripting\python\current\python-3.10.5.amd64\python.exe -m black --verbose --stdin-filename v:\my\invoice\src\main.py -
2024-02-11 11:12:46.241 [info] [Trace - 11:12:46 AM] Received notification 'window/logMessage'.
2024-02-11 11:12:46.241 [info] CWD formatter: v:\my\invoice
2024-02-11 11:12:46.246 [info] [Trace - 11:12:46 AM] Received notification 'window/logMessage'.
2024-02-11 11:12:46.246 [info] Identified `G:\programming\my\invoice` as project root containing a .git directory.
v:\my\invoice\src\main.py ignored: is a symbolic link that points outside G:\programming\my\invoice
No Python files are present to be formatted. Nothing to do 😴

2024-02-11 11:12:46.246 [info] [Trace - 11:12:46 AM] Received response 'textDocument/formatting - (1)' in 12ms.

Perhaps related:

2024-02-10 22:48:23.452 [info] CWD formatter: v:\my\invoice
2024-02-10 22:48:23.553 [info] Version info for formatter running for G:\programming\my\invoice:

"v" is a mapped device v -> G:\programming. But this has to be supported.

This all works with the now deprecated addon from (https://marketplace.visualstudio.com/items?itemName=joslarson.black-vscode)

Edit: I fixed the incorrect setting of blacks "--verbose" flag by myself and the verbose output becomes more clear now (see large output block above). So, this seems to be some problem with black itself? Or is it the version info gathering run as seen in the last cited output that causes the complete break of the actual formatting task?

@github-actions github-actions bot added the triage-needed Issue is not triaged. label Feb 10, 2024
@karahanyilmazer
Copy link

I faced the same issue. For some reason Black didn't work in git folders. But when I create a new folder with a Python file and make some changes, Black could find the file and format it correctly. Then when I run git init Black stopped working for some reason. Deleting the .git hidden folder seems to resolve the issue after some time.

Solution: I reverted back to v2023.6.0 until the issue is fixed.

@karthiknadig
Copy link
Member

This is an issue with black itself (see psf/black#4205). The current option is to pin the extension to older version until a fix is released by black.

@karthiknadig karthiknadig closed this as not planned Won't fix, can't repro, duplicate, stale Feb 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage-needed Issue is not triaged.
Projects
None yet
Development

No branches or pull requests

3 participants