title: Django - using thread.start_new_thread for reading a file throws exception while "simplejson.loads"
body: <p>i have a log file, which i have to parse.
  log file may have 3 types of lines </p>
  
  <pre><code>cat- xxxxxxxxxxxxx
  dog - xxxxxxxxxxxxxxx
  rat - xxxxxxxxxxxxx
  </code></pre>
  
  <p>my parse function in python script is </p>
  
  <pre><code>from django.utils import simplejson
  
  
  simplejson.JSONEncoder.item_separator = ','
  simplejson.JSONEncoder.key_separator = ':'
  
  
  def parseFile(self):
       thread.start_new_thread(self.part1,("rat",))
       thread.start_new_thread(self.part1,("dog",))
       thread.start_new_thread(self.part1,("cat",))
  
  def part1(self, tag):
          try:
              print "eating %s feed statements\n"%tag
              log_file = open(self.file,'r')
              for line in log_file:
                      if line.find(tag) != -1:
                              msg = self.getJsonMessage(line)
                              print "hello1"
                              self.META_TAGS[tag](msg)
              log_file.close()
              print "finished eating %s\n"%tag
              print self.positiveCount, self.negcount, self.nocount
          except Exception,e:
              print e
  
  
   def getJsonMessage(self,line):
              parts = line.split(' ')
              jsonstr = ''
              count = 4
              while(count&lt;len(parts)):
                      jsonstr += ' ' + parts[count]
                      #print parts[count]
                      count = count + 1
              print jsonstr
              msg = simplejson.loads(jsonstr)        //LINE 1
              date = parts[0].split('-')
              time = parts[1].split(':')
              seconds = time[2].split(',')
              msg['feed_date'] = datetime(int(date[0]),int(date[1]),int(date[2]),int(time[0]),int(time[1]),int(seconds[0]),int(seconds[1]))
              return msg
  </code></pre>
  
  <p>Now when the code reached LINE 1 throws an exception</p>
  
  <h2>'NoneType' object has no attribute 'loads'</h2>
  
  <p>I know simplejson has been deprecated in present version of django, but i m using an older version.</p>