Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Python

Converting existing tabs to spaces IndentationError: unindent does not match any outer indentation level

Hello all. Not sure if this is legal here but I figured I would give it a try.

in the workspace, I somehow used a mixture of Tabs and Spaces in my code. It was driving me absolutely bonkers because nothing would work. Running the code would either give me the IndentationError or the TabError. When I searched the forums the only answer I could find was that I would have to go back and manually change all existing tabs to spaces. This did not seem optimal. after a quick search, I found this site and it saved my entire evening. Now I don't know if I am allowed to throw other sites on here but let's give it a shot.

https://www.browserling.com/tools/tabs-to-spaces

Thanks, Vincent

1 Answer

Steven Parker
Steven Parker
216,083 Points

A reputable 3rd party site shouldn't be a problem, but a sketchy one might. I can't view your code because I get an authenticity verification failure from my browser.

Also, you've posted this in "General" instead of a language group. But I'm going to guess your program is in Python, and one of the rules of Python is that you may use tabs or spaces, but not both in the same program. So you'll just need to convert to one or the other (I recommend spaces) and use it consistently.

You can edit the question and move it to the appropriate group if you want.

Thank you for the info, Mr. Parker. I will change it too the python forum.