Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial


Colin Warn
Colin Warn
6,358 Points

IndentationError: Expected an Indented Block

Keep getting this error when I run this. I tried copy/pasting this into pycharm, selecting an option that converted all the spaces to tabs, then tried vice-versa, neither worked. What am I supposed to do?

from peewee import *
import datetime

db = SqliteDatabase('diary.db')

class Entry(Model):
    content = TextField()
    timestamp = DateTimeField(default=datetime.datetime.now)

    # timestamp

    class Meta:
        database = db
def initialize():
    # Create database and table if they don't exist
    db.create_tables([Entry], safe=True)

def menu_loop():
    # Show the menu

def add_entry():
    # Add entry

def view_entries():
    # View previous entries
def delete_entry(entry):
    # Delete entry

if __name__ == '__main__':

Moderator edited: Added markdown so that the code will render properly on the forums.

Jennifer Nordell
Jennifer Nordell
Treehouse Teacher

Hi Colin! I've taken the liberty of adding some markdown to your code so that it will be easier for others to read. The answer below has a pretty good description of how to do this. For more formatting tips and tricks, take a look at the Markdown Cheatsheet link at the bottom :arrow_down: of the "Add an Answer" section. :sparkles:

1 Answer

Hi there, if you paste the code into the comment box it's pretty hard for us to spot whitespace issues. Would you mind pasting the affected lines again, but putting 3 back ticks before and after your code like this (I've used apostrophes so you can see):


# some code


so it looks like:

#some code