jason-kane/PyYapf

Error when running in Windows

virgiliu opened this issue · 1 comments

The code:

def a():
    x = 1
     return x

The error:

Traceback (most recent call last):
      File "C:\Programs\Sublime Text\sublime_plugin.py", line 556, in run_
        return self.run(edit)
      File "PyYapf in C:\Programs\Sublime Text\Data\Installed Packages\PyYapf Python Formatter.sublime-package", line 217, in run
      File "./subprocess.py", line 824, in __init__
      File "./subprocess.py", line 1118, in _execute_child
    FileNotFoundError: [WinError 2] The system cannot find the file specified

In command prompt:

C:\Users\me>yapf --version
yapf 0.2.5

Is there a way to tell the plugin the location of the yapf executable?

You can set the path to the yapf executable in the sublime config:

{
      // full path and command to run yapf
      "yapf_command": "/usr/local/bin/yapf",

When I get some time I may change it to use either the python path (to locate the yapf module) or the system path (to find the executable); either would be better than this.