I did pip install black for VS code editor. It is an alternative to prettier for python in vs code.
I received the following issues when I run black Untitled-1.py.
Program 'black.exe' failed to run: Access is deniedAt line:1 char:1 + black Untitled-1.py + ~~~~~~~~~~~~~~~~~~~. At line:1 char:1 + black Untitled-1.py + ~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ResourceUnavailable: (:) [], ApplicationFailedException + FullyQualifiedErrorId : NativeCommandFailed In the VS terminal.
I did not understand why access is deniedAt. I do not have any antiviruses running on my Windows 10.
1 Answer
I uninstalled python and ensure that it is uninstalled everywhere on my machine including the default version that comes with windows 10 now.
- Uninstall python
- Make sure you follow this link.
- Restarted the machine
- Reinstall the newest version of python
- Install black
pip install black - In the VS code editor ensure the setting knows the location of black here is a small setting in JSON for those interested:
{ "workbench.colorTheme": "Community Material Theme High Contrast", "editor.mouseWheelZoom": true, "workbench.iconTheme": "Monokai Pro Icons", "editor.defaultFormatter": "esbenp.prettier-vscode", "[solidity]": { "editor.defaultFormatter": "JuanBlanco.solidity", "editor.formatOnSave": true }, "editor.guides.bracketPairs": true, "[python]": { "editor.defaultFormatter": "ms-python.python", "editor.formatOnSave": true }, "editor.formatOnSave": true, "jupyter.askForKernelRestart": false, "python.defaultInterpreterPath": "C:\\Users\\Username\\AppData\\Local\\Programs\\Python\\Python310\\python.exe", "python.formatting.blackPath": "C:\\Users\\Username\\AppData\\Local\\Programs\\Python\\Python310\\Scripts\\black.exe", "python.formatting.provider": "black" }
- Then create a new file and save
This has solved my problem!
