Using a Proper Text Editor
Hey, you! Yeah, you. Come on over. We need to have a chat. Let’s just get a few things out in the open so we can discuss it like adults.
We need to talk about that text editor you might be using.
You should never open or edit a Python file with a program such as Microsoft Word, TextEdit (Mac), LibreOffice, Pages, or any other page layout program. Just say no! It won’t work. You will get frustrated. Your code won’t run. It won’t work. (Did I say that already?) There are pretty much…let’s see… zero reasons to open code of any kind in such a program. You are only asking for trouble.1
You know you have troubles if your Python script opens in one of these programs when you double-click it. It shouldn’t.
Check for the following things if this happens to you:
- The file extension may be wrong It is very easy to get the .txt extension tacked onto a .py script if you don’t watch what Windows is doing.
- Your system may, for some reason, be setup to open
.pyfiles with one of these programs. Make sure your system is setup to open
.pyfiles with your text editor.
Proper Text Editors
You really need to install and use a Proper Text Editor to be productive when scripting. Python especially is easier to write and develop with if you have an editor to help make the whitespace and syntax easier to see.
I have some recommendations to make. Check out my 2017 list of Recommended Text Editors.
I don’t even use these programs to edit text much, actually. I think the last time I opened Word at work was in July…of last year. ↩