Running pep8 under Stash
I was trying to get the python code formatter pep8 to run under stash but I get the error:
stash: <type 'exceptions.ValueError'>: signal only works in main thread
If this cannot run under stash for some reason, what is the easiest way to run it and pass a file parameter?
ywangd last edited by ywangd
You need a few modifications for it to work with StaSh.
signalis not really needed for pep8. So you can ignore the error by changing line 2124 to
except (AttributeError, ValueError):
this_filename = inspect.getfile(register_check) for name, obj in inspect.currentframe().f_globals.items(): if inspect.isfunction(obj) and inspect.getfile(obj) == this_filename: register_check(obj)
Now you should be able to run this from within stash.
Thank you. I made the changes and the error msg goes away but when I run pep8 with a file parameter of a script, it just returns (i.e. no output at all).
For "extra credit", I would also like to be able to run autopep8 from Stash. It fails with an 'exceptions.KeyError'
ywangd last edited by
The second change to
pep8.pyis to fix the no output issue. I am not sure why it did not work for you, unless you ran it through an already fully pep8 compatible file.
Anyway, I uploaded my patched versions of both
You should now be able to run
@ywangd Works perfectly! Thank you.