프로그래밍/오류(Error)정리

[Syntax Error] unindent does not match any outer indentation level

LaonMoon 2020. 2. 3. 12:01

SyntaxError: unindent does not match any outer indentation level

 

예외 처리 기법인 try, except문을 사용하다가 오류가 발생했다.

unindent does not match any outer indentation level

▶ indentation : 들여쓰기

 

즉, 들여쓰기가 틀렸다는 뜻의 에러다. 파이썬 인터프리터에서 들여쓰기를 할 때 탭과 스페이스 사용을 섞어서 하면 오류가 발생하는 경우가 있다.

 

해결방법)

보통은 스페이스 네 번을 사용하며 해결할 수 있다.

 

하지만 내 경우에는 try, except를 인터프리터가 아닌 에디터 창에서 작성해야 했다. 애초에 책에 나와 있는 것처럼 하면 되는데, 순간 습관적으로 shell창에 작성했던 실수로 오류가 났던 것이었다.