Tuesday, August 05, 2008

Python gotcha

This Seemingly innocuous indentation error in python was annoying me.

Problem invoking WLST - Traceback (innermost last):
(no code object) at line 0
File "C:\apps\installWls.py", line 249
toDeploy = sys.argv[3]
^
SyntaxError: inconsistent dedent

Looking at my code (wlst code to auto deploy application into weblogic server), it was all indented correctly.

Well of course the computer was right. It wasn't indented correctly, but it was no obvious.

The issue was some copy and paste code I took from the internet.

It was indented using spaces, whereas I was using tabs.

Replacing the space indentation with tabs fixed the issue (but its not obvious uinless you set your editor to display non visible characters.