Reputation: 20906
I have lot of issues with Python indentation with the Notepad++. Inorder to resolve, I tried to install Python reindent module but Im unsuccessful on how to use it. If anyone had been successful, please let me know..
Here are the steps I tried.
1.Using easy install I tried to install the package,
C:\Python27\Scripts>easy_install reindent
Searching for reindent
Reading http://pypi.python.org/simple/reindent/
Best match: Reindent 0.1.1
Downloading http://pypi.python.org/packages/source/R/Reindent/Reindent-0.1.1.tar
.gz#md5=878352c36c421a0b944607efba3b01ad
Processing Reindent-0.1.1.tar.gz
Running Reindent-0.1.1\setup.py -q bdist_egg --dist-dir c:\users\premvi~1\appdat
a\local\temp\easy_install-qdahih\Reindent-0.1.1\egg-dist-tmp-1z1zw8
zip_safe flag not set; analyzing archive contents...
Adding reindent 0.1.1 to easy-install.pth file
Installing reindent script to C:\Python27\Scripts
Installed c:\python27\lib\site-packages\reindent-0.1.1-py2.7.egg
Processing dependencies for reindent
Finished processing dependencies for reindent
when I did a import command on the python GUI it was successful.
I get the below error when I try to use it.
>>> import reindent
>>> reindent -d c:/python27/wxpython/ch2-updateui.py
SyntaxError: invalid syntax
>>> reindent -d c:\python2\wxpython\ch2-updateui.py
SyntaxError: invalid syntax
Please let me know how to resolve it.
Upvotes: 1
Views: 7012
Reputation: 179707
You're trying to run the command from the Python interpreter instead of the command line. As reindent is a script program, it needs to be run from the command line.
You want to use either
C:\...\> python -m reindent -d C:\Python27\wxpython\ch2-updateui.py
or just
C:\...\> reindent -d C:\Python27\wxpython\ch2-updateui.py
at your command prompt.
Upvotes: 5
Reputation: 22841
Try downloading this as reindent.bat in your C:\Python27\Scripts. Then it should just be a matter of reindent path\to\file.py
Upvotes: 1
Reputation: 65851
I don't know anything about the package, but the command you are using indeed does not conform to Python syntax. I'd guess you need to run it in your terminal, not Python interpreter.
Upvotes: 2