0

I am going away from tabs to spaces and would like to convert my current *.py files to this convention. It appears reindent.py is the recommended way of doing this.

After installing it on Ubuntu using sudo apt-get install python-examples, it ended up in /usr/share/doc/pythonx.x/examples/Tools/scripts/reindent.py.

Is there a preferred/recommended way of running such scripts without referencing the directory, and perhaps without adding that directory to my Path variable?

I hope to run this on single files and in batch, such as described HERE:

find . -type f -name "*.py" | xargs python reindent.py --nobackup
Community
  • 1
  • 1
ryanjdillon
  • 17,658
  • 9
  • 85
  • 110

2 Answers2

1

Just copy the file, or symlink it.

It is a stand-alone script, it does not depend on anything else in scripts directory, so it can live anywhere. Symlinking or copying it into a directory that is on your $PATH would enable you to run it without any path prefix (provided the executable bit is set, chmod +x reindent.py).

Martijn Pieters
  • 1,048,767
  • 296
  • 4,058
  • 3,343
1

You can easy_install reindent or pip install reindent, and then it will be on your path as command reindent

Xuan
  • 5,255
  • 1
  • 34
  • 30