Munch Lab

Download and install a code editor

Sublime_Text_Logo

Just like you probably write prose and other kinds of text in Microsoft Word you will need a program (an editor) to write python in. This year the best available editor for this purpose is Sublime Text 2. There are simpler and more advanced editors out there, but this one strikes a nice balance between simplicity and capability.

Download and install

To download Sublime Text 2 follow this link. On the page you are directed to click the link corresponding to your operating system (e.g. Linux, Mac, Windows). Having downloaded the installer there will be platform specific ways in which installing proceeds. You probably know that better for your own computer than I do.

Using Sublime Text 2

Open the editor from Applications (on a mac) or from the Start menu (Windows). In the “file” menu you can then choose “new file” to get a window for writing in if one does not pop up by itself. Before you start writing save the file and give it a “.py” suffix (e.g. myfile.py). The suffix tells Sublime Text that it is a python file and it will then color your code and allow you to execute the code by pressing “cmd+B” (on Mac) or “ctrl+B” (on Windows).  Play around with it to get comfortable with your new best friend.

The Sublime Text 2 editor is free, but you will be asked if you want to purchase it now and then. Just press “cancel” if you do not want to buy it. It will keep working just the same.

Sublime Text has it quirks. Here is a list of things to remember for a happier life with Sublime Text. If solve problems that have other causes pleas send me an email and I will add them to the list:

  • Always save your file before you try to run your code (with cmd-B, or ctrl-B)
  • Always give you file names a “.py” extension so that Sublime Text knows it is a Python file.
  • Only use english letters and numbers in your file names – and do not put any spaces in them.
  • Do not save your files in a folder that has any parent folder with a æ, ø or å in them. e.g. C:\\Users\Me\Dokumenter\FolderWithØinIt\AppliedProgramming

If everything fails try the IDLE editor that was installed on your computer. It is not as nice as Sublime Text but may work just fine for you.

One thought on “Download and install a code editor”

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: