title: Error in python 2.7 imports on urllib2,re and base64
body: <p>I have a python file which runs okay on my local computer but logs these errors on my server Python 2.7.9 (default) [GCC 4.4.7 20120313 (Red Hat 4.4.7-11)] on linux2</p>
  
  <pre><code>SyntaxError: invalid syntax
  Traceback (most recent call last):
    File "/home/&lt;dir&gt;/kb_log.py", line 8, in &lt;module&gt;
      import urllib2
    File "/usr/local/lib/python2.7/urllib2.py", line 92, in &lt;module&gt;
      import base64
    File "/usr/local/lib/python2.7/base64.py", line 8, in &lt;module&gt;
      import re
    File "/usr/local/lib/python2.7/re.py", line 105, in &lt;module&gt;
      import sre_compile
    File "/usr/local/lib/python2.7/sre_compile.py", line 62
      for t in _equivalences for i in t}
  </code></pre>
  
  <p>when i fire the Python Shell on my server and import urllib2 i get not errors</p>
  
  <p><strong><em>Edited</em></strong> 
  The code python code triggering the errors is </p>
  
  <pre><code>import urllib2
  import time
  import socket
  import smtplib
  
  
  from django.core.mail import send_mail
  
  
  message = {404:"The Page not found possibly a missing",
              "slow":"The site is very slow",
              502:"502 Gateway either I restarted the server or it's not responding",
              504:"Server is down :("}
      address = "myemail@gmail.com"      
  
  def test_speed(url="mydress",timeouttest=2):     
      try:
          begin_time = time.time()
          requesttest = urllib2.urlopen(url,None,timeouttest)
          requesttest.read()
          return "Site is okay with a response time of {0}".format(time.time() - begin_time)
      except socket.timeout:
          return message["slow"]   
      except urllib2.HTTPError, e:
          return message[e.code]
  def send_email():
      result = test_speed()
      server = smtplib.SMTP('smtp.gmail.com', 587)
      server.starttls()
      server.login("mail@gmail.com", "xdjmfppkffwmiwvh")
      server.sendmail("mail1@gmail.com", ['mail@gmail.com','mail2@gmail.com'], result)
      server.quit()
  
  if __name__ == '__main__':    
      send_email()
  </code></pre>