#35308: FileNotFoundError escapes from run_formatters()
-------------------------------+--------------------------------------
Reporter: Jacob Walls | Owner: nobody
Type: Bug | Status: new
Component: Uncategorized | Version: 4.2
Severity: Normal | Resolution:
Keywords: black | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Comment (by Jacob Walls):
My colleagues were developing on Macs. I just mentioned the Windows
information when seeing it in the python docs.
This isn't a solid reproducer, but I managed to hack together an example
that at least fails to launch. Something else must be responsible for
escaping the FileNotFoundError, since the call to subprocess.run does not
include `check=True`. (I'm not saying this is how my colleagues reproduced
it they had black installs from in abandoned environments, unsure what
versions of pip, black, homebrew etc were used):
{{{
~ % chmod 777 /opt/homebrew/bin/black
~ % chmod 644 /opt/homebrew/bin/black
~ % chmod +u /opt/homebrew/bin/black
~ % chmod -u /opt/homebrew/bin/black
~ % chmod +u /opt/homebrew/bin/black
~ % chmod +x /opt/homebrew/bin/black
~ % python3.12
Python 3.12.0 (v3.12.0:0fb18b02c8, Oct 2 2023, 09:45:56) [Clang 13.0.0
(clang-1300.0.29.30)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import shutil
>>> import subprocess
>>> subprocess.run(shutil.which('black'))
/opt/homebrew/Cellar/pyt...@3.11/3.11.5/Frameworks/Python.framework/Versions/3.11/Resources/Python.app/Contents/MacOS/Python:
can't open file '/opt/homebrew/bin/black': [Errno 13] Permission denied
CompletedProcess(args='/opt/homebrew/bin/black', returncode=2)
}}}
--
Ticket URL: <
https://code.djangoproject.com/ticket/35308#comment:3>