3

When I press Ctrl + alt + F , It says :

OSError: [WinError 5] Access is denied

You may need to install YAPF and/or configure 'yapf_command' in PyYapf's Settings.

So I have already installed YAPF and configured in PyYapf's Settings :

// full path and command to run yapf
"yapf_command":"C:\\Users\\MyUserName\\AppData\\Local\\Programs\\Python\\Python37-32/Lib\\site-packages\\yapf",

What's wrong and with what? Why Yapf doesn't work. I've also installed a package of yapf.

Nikiphor
  • 31
  • 3
  • generally you should have access under `"C:\\Users\\MyUserName\\AppData\\Local\\Programs\\Python\\Python37-32/Lib\\site-packages\\yapf` if you are the same logged in user. You might want to check if you installed it as admin and have no access to it - simply browse to the directory and check its file/dir-permissions and if you can access it outside of sublime. maybe change them if you know what you are doing. – Patrick Artner Oct 12 '19 at 10:38
  • I'm that same user and I can access it outside of sublime. I mean just open it/ – Nikiphor Oct 12 '19 at 11:44
  • 1
    This error generally means that you're trying to run a directory instead of a program. Make sure you're also including the name of the program and not just the folder it's in. – OdatNurd Oct 12 '19 at 12:25
  • Just to clarify that comment now that I'm not on mobile, while Access Denied can mean that you don't have permission to do a thing with a file, in the case of this error being generated by a build system on Windows, it usually means that you've accidentally entered the path to the place where the binary is in the `cmd` of your build system; in `cmd` it has to be the full path ***including the name of the program*** (i.e. you're telling it what to run, not where to find what you want to run). – OdatNurd Oct 12 '19 at 17:28
  • There is no file named "yapf". Only folder. And even if I try to write full path with the name of some program, there are only ".py" files, so there is an error : OSError: [WinError 193] %1 Is Not a Valid Win32 Application You may need to install YAPF and/or configure 'yapf_command' in PyYapf's Settings. – Nikiphor Oct 13 '19 at 03:39
  • What does the documentation for the package you're using have to say about how to configure it? – OdatNurd Oct 13 '19 at 20:53

1 Answers1

1

There are 2 parts of problem:

  1. You may need to install YAPF
  2. Configure 'yapf_command' in PyYapf's Settings.

The first part can be solved by:

pip install yapf

In second part of problem, you need to configure path to the Yapf binary. In Linux, binaries go to /usr/bin/. I'm not completly sure for Windows equivalent, but try 1:

{
  "yapf_command": "C:/Users/your_user_name/AppData/Local/Programs/Python/Python37-32/Scripts/yapf.exe"
}
Dinko Pehar
  • 5,454
  • 4
  • 23
  • 57