jason-kane/PyYapf

Running the plugin does nothing

sametmax opened this issue · 4 comments

Code is:

def fib() :
    a,b = 0,1
    while True :
        yield b
        a,b=b, a+b

I hit Ctrl + shift + P, I click on PyYapf, the code doesn't change.

File is saved, syntax set to Python. Ubuntu 14.04, sublime text 2.

What does the sublime console say (control ~)? It is usually very informative

The error is :

Running [u'/usr/local/bin/yapf', '--style=/tmp/tmpudDlAj', '--verify', '--in-place', '/tmp/tmp2xIuGP.py']
Traceback (most recent call last):
  File "./sublime_plugin.py", line 362, in run_
  File "./PyYapf.py", line 217, in run
  File ".\subprocess.py", line 633, in __init__
  File ".\subprocess.py", line 1139, in _execute_child
OSError: [Errno 2] Aucun fichier ou dossier de ce type

I got yapf installed, but with "pip install --user" since it's not recommended to use "sudo".

So if you want it to work, you'll need to use yapf not matter where it's installed. A better way would be to use "python -m yapf":

 [u'python, '-m', 'yapf', '--style=/tmp/tmpudDlAj', '--verify', '--in-place', '/tmp/tmp2xIuGP.py']

This has the additional benefit of working on windows because the path is not hard coded.

You can specify the path to yapf in the config file. The global is the default.

Ok, but if I got bitten by this, you can expect many people to be. Wouldn't it make sense to use as a default value "python -m yapf" to avoid this edge case and make it a better experience from the start ?