Why is my code not compiling : <p>I am just learning Python and decided to write a really simple Python bot to reply on Reddit.</p>

<p>On compiling I am getting the following error:</p>

<blockquote>
  <p>File "C:\Python35\Scripts\RedditBot\Reddit.py", line 28
      except attributeerror:
           ^ SyntaxError: invalid syntax</p>
</blockquote>

<p>I am unable to see what is causing this as the code looks correct to me. </p>

<pre><code>import praw

USERAGENT = "BOT Name"
USERNAME = "Username"
PASSWORD = "Password"
SUBREDDIT = "Subreddit"
MAXPOSTS = 100

SETPHRASES = ["Phrase", "PhraseOne"]
SETRESPONSE = "This is the response."

print('Logging in to Reddit')
r = praw.Reddit(USERAGENT)
r.login (USERNAME, PASSWORD)

def replybot():
    print('Fetching Subreddit ' + SUBREDDIT)
    subreddit = r.get_subreddit(SUBREDDIT)
    print('Fetching comments')
    comments = subreddit.get_comments(limit=MAXPOSTS)
    for comment in comments:
        try:
            cauthor = comment.author.name
            cbody = comment.body.lower()
            if any(key.lower() in cbody for key in SETPHRASES):
                print("Replying to " + cauthor)
                comment.reply(SETRESPONSE)
            except attributeerror:
                pass
replybot()
</code></pre>
