title: I am getting AttributeError: 'TBXTools' has no attribute 'cur'
body: <p>I have a file called TBXTools I am trying to run it through another file using </p>
  
  <pre><code>from TBXTools import *
  e=TBXTools()
  </code></pre>
  
  <p>Looks very simple ain't it. But when I run it I get this error:</p>
  
  <p>AttributeError: 'TBXTools' has no attribute 'cur'</p>
  
  <p>Now I have that method, right there on 'TBXTools' file . So what's wrong? Please help</p>
  
  <pre><code>def load_sl_tl_corpus(self,slcorpusfile, tlcorpusfile, encoding="utf-8"):
      '''Loads a bilingual corpus in Moses format (that is, in two independent files. It expects one segment per line.'''
      self.slcf=codecs.open(slcorpusfile,"r",encoding=encoding)
      self.tlcf=codecs.open(tlcorpusfile,"r",encoding=encoding)
      self.sl_data=[]
      self.tl_data=[]
      self.continserts=0
      while 1:
          self.sl_segment=self.slcf.readline()
          if not self.sl_segment:
              break
          self.tl_segment=self.tlcf.readline()
          self.continserts+=1
          self.max_id_corpus+=1
          self.sl_record=[]
          self.tl_record=[]
          self.sl_segment=self.sl_segment.rstrip()
          self.tl_segment=self.tl_segment.rstrip()
  
          self.sl_record.append(self.max_id_corpus)
          self.tl_record.append(self.max_id_corpus)
          self.sl_record.append(self.sl_segment)
          self.tl_record.append(self.tl_segment)
          self.sl_data.append(self.sl_record)
          self.tl_data.append(self.tl_record)
          if self.continserts==self.maxinserts:
              self.cur.executemany("INSERT INTO sl_corpus (id, segment) VALUES (?,?)",self.sl_data)
              self.cur.executemany("INSERT INTO tl_corpus (id, segment) VALUES (?,?)",self.tl_data)
              self.sl_data=[]
              self.tl_data=[]
              self.continserts=0
      with self.conn:
          self.cur.executemany("INSERT INTO sl_corpus (id, segment) VALUES (?,?)",self.sl_data)   
          self.cur.executemany("INSERT INTO tl_corpus (id, segment) VALUES (?,?)",self.tl_data)  
      self.conn.commit()
  </code></pre>
  
  <p>I am calling it like this:</p>
  
  <pre><code>e.load_sl_corpus("Main corpus.txt")
  </code></pre>
  
  <p>Note: I tried to run it through <code>python -tt</code> but I got the same error</p>
  
  <p>Here are a small sample from my input file:</p>
  
  <p>Clearance returns value as a percent of sales retail amount. 
  purchase order estimated landed cost each time this item is received at this location, or the primary supplier cost, depending on the merchandising system options. 
  purchase order estimated landed cost each time this item is received at this location, or the primary supplier cost, depending on the merchandising system options. 
  Retail value of original planned markdown amounts due to regular sales.<br>
  Quantity of unavailable clearance inventory at a location at the beginning of the reporting period, across all inventory status codes.
  The percent of demand that flows through to net sales, after accounting for returns and cancellations. Derived as the sum of returns and cancellations divided by demand sales retail value, subtracted from 1 to get the inverse percent value. 
  @RICP2@ - Shrink Non-Clr Cost Amt
  Customer Segment Occupation Code
  Flexible fact column 31 for text or non-numeric values. </p>
  
  <p>Edit:</p>
  
  <p>I am already create a function to connect my database please have a look below:</p>
  
  <pre><code>def create_project(self,project_name,sl_lang,tl_lang="null",overwrite=False):
      '''Opens a project. If the project already exists, it raises an exception. To avoid the exception use overwrite=True. To open existing projects, use the open_project method.'''
      if os.path.isfile(project_name) and not overwrite:
              raise Exception("This file already exists")
  
      else:
          if os.path.isfile(project_name) and overwrite:
              os.remove(project_name)
          self.sl_lang=sl_lang
          self.tl_lang=tl_lang
          self.conn=sqlite3.connect(project_name)
          self.cur = self.conn.cursor() 
          self.cur2 = self.conn.cursor()
          with self.conn:
              self.cur = self.conn.cursor()
  </code></pre>