Montreal Python Workshop/Friday/Linux text editor

From OpenHatch wiki

Using Gedit

If you’re using Ubuntu or another operating system with the Gnome desktop environment, you can use Gedit, which will be installed as part of Gnome, to write Python code. You can start it by following Applications → Accessories → Text Editor in the main menu. If you don’t see it, let a staff member now.

Gedit needs some configuration to indent with spaces, to follow the convention used by most Python programmers.

  • Click Edit -> Preferences
  • Select the tab labeled "Editor"
  • In the "Tab width" field, set it to 4 (the default is 8)
  • Check the box labeled "Insert spaces instead of tabs"
  • Check the box labeled "Enable automatic indentation"
  • Click Close.

That's it! Now, you can hit tab to indent your code, and that indentation will actually be made of spaces. This change will help you use spaces consistently, so that Python doesn't get confused about whitespace.

Using other text editors

If you’re already familiar with Emacs or Vim, they are excellent editors for Python.

Success!

If you prefer a different editor for text, check with an instructor before moving on to make sure it will work for the weekend.

« Back to the Friday setup page