sublack
sublack copied to clipboard
Configuring User Options
I get this error when running sublack. (MacOS 10.15.7, SublimeText 3.2.2)
OSError: [Errno 2] No such file or directory: 'black'
You may need to install Black and/or configure 'black_command' in Sublack's Settings.
My User Settings are
{
"settings": {
"python_interpreter": "/Users/a59/.pyenv/shims/python",
"sublack": {
"black_on_save": true,
"black_command" : "/Users/a59/.pyenv/shims/black"
}
}
}
Am I doing something wrong? It wasn't clear to me from the documentation.
Here's what worked for me:
- Navigate to package settings via menu bar:
![Screenshot 2021-10-24 at 15 47 24](https://user-images.githubusercontent.com/699568/138594894-734934ba-a926-4be5-b3f9-11fc2f20c0ce.png)
- Paste the following into the file:
{
"black_command": "~/.pyenv/shims/black",
"black_on_save": true
}
Save and restart the editor.
Ok. I figured it out. Go to Preferences -> Package settings -> sublack -> Settings In the new sublack.sublime-settings file, paste the following: { "black_command": "C:/Users/analk/AppData/Local/Packages/PythonSoftwareFoundation.Python.3.10_qbz5n2kfra8p0/LocalCache/local-packages/Python310/Scripts/black.exe", }
To find the particular path for, in your python interpretor,
import black print(black.path)
The output will be a folder's path. There will be a folder named 'Scripts' on the same level as 'site-packages' folder. The black.exe file will be inside the Scripts folder. You'll have to provide that path in the above "black_command" line.