title: Python - ascii codec can't decode byte 0xe3 in position 0: ordinal not in range(128)
body: <p>I am working on a bot for a Twitch.tv channel and one of the commands is supposed to work like this:</p>
  
  <p>user inputs: !riot (text)</p>
  
  <p>bot outputs: ヽ༼ຈل͜ຈ༽ﾉ(text) OR RIOT ヽ༼ຈل͜ຈ༽ﾉ</p>
  
  <p>The problem is whenever someone tries to input the command an error gets displayed in the cmd window which says: "ascii codec can't decode byte 0xe3 in position 0: ordinal not in range(128)". Nothing is displayed in the chat.</p>
  
  <p>I have the coding set to UTF-8 at the beginning of the file so i'm not sure why its giving me this error.</p>
  
  <p>Heres the snippet of code for the command itself and the defining of doCommandProcess: <a href="http://imgur.com/a/R1G1e" rel="nofollow">http://imgur.com/a/R1G1e</a></p>
  
  <p>Heres the snippet of code for the command and the defining of doCommandProcess in the previous version of the bot that works just fine: <a href="http://imgur.com/a/0tQpE" rel="nofollow">http://imgur.com/a/0tQpE</a></p>
  
  <p>I'm just really confused because both versions are encoded with UTF-8 and have nearly identical code yet one refuses to work and gives me an ascii error. </p>
  
  <p>EDIT: Heres the code in question:</p>
  
  <pre><code>def doCommandProcess( text, irc ):
      try:
  
          usernamearray = text.split('!')
          username = usernamearray[0]
          username = username[1:]
  
          messagearray = text.split(':')
          message = messagearray[2]
  
          if(len(usernamearray) &gt;= 0 and len(messagearray) &gt;= 2):
  
              sqlcommands.doCommand(message, irc)
  
              customcommands.docustomcommands(message, irc)
  
              print username + ": " + message
  
          if commandStartsWith(message, '!riot'):
              print len(message)
              if(len(message) &gt; 8):
              riotmessage = message[6:]
              riotmessage = riotmessage.strip().upper()
                             respond(irc, 'ヽ༼ຈل͜ຈ༽ﾉ ' + riotmessage + ' OR RIOT ヽ༼ຈل͜ຈ༽ﾉ')
          else:
              respond(irc, 'You need to give a reason to riot!')
  
      except Exception,e:  
          #If an error happens
          #Print a new line for visibility
          print text
          print ""
          print str(e)
  </code></pre>