sublack icon indicating copy to clipboard operation
sublack copied to clipboard

Configuring User Options

Open a59 opened this issue 3 years ago • 2 comments

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.

a59 avatar Apr 13 '21 15:04 a59

Here's what worked for me:

  1. Navigate to package settings via menu bar:
Screenshot 2021-10-24 at 15 47 24
  1. Paste the following into the file:
{
	"black_command": "~/.pyenv/shims/black",
	"black_on_save": true
}

Save and restart the editor.

gediminasz avatar Oct 24 '21 12:10 gediminasz

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.

analkumar2 avatar Feb 18 '22 09:02 analkumar2