You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The ’black’ formatter is not installed, please install it using ‘elpy-config’ or choose another one using ‘elpy-formatter’
I found that this error happens in some buffers but not others. The cause is python prepending '' to sys.path when
called with the -c option, which Elpy does in the function elpy-config--package-available-p and probaby in other
places.
Steps to reproduce
Configure Elpy to use Black for formatting.
Create a directory containing two files: formatme.py and secrets.py.
Ensure that importing secrets.py will result in an error.
Try to format code in formatme.py using elpy-format-code.
When Elpy tries to check for Black by importing it with python -c "import black", it will
fail because Black contains a module called secrets.py, but it'll import your erroneous version
because of '' getting prepended to sys.path.
To stop '' from getting prepended to sys.path, it is necessary to write the Python command
to be executed to a file and them have Python execute the file.
Result of (elpy-config)
# Paste it here
Elpy configuration in my init.el
# Paste it here
The text was updated successfully, but these errors were encountered:
Summary
I found that this error happens in some buffers but not others. The cause is
python
prepending''
tosys.path
whencalled with the
-c
option, which Elpy does in the functionelpy-config--package-available-p
and probaby in otherplaces.
Steps to reproduce
formatme.py
andsecrets.py
.secrets.py
will result in an error.formatme.py
usingelpy-format-code
.When Elpy tries to check for Black by importing it with
python -c "import black"
, it willfail because Black contains a module called
secrets.py
, but it'll import your erroneous versionbecause of
''
getting prepended to sys.path.To stop
''
from getting prepended to sys.path, it is necessary to write the Python commandto be executed to a file and them have Python execute the file.
Result of
(elpy-config)
Elpy configuration in my init.el
The text was updated successfully, but these errors were encountered: