title: I'm getting a syntax error on my IF statement, not sure why?
body: <p>I'm trying to run the following code in python 3.7. I keep getting a invalid syntax error and not sure why, can someone spot what i'm doing wrong? Indent seems to be fine, my "Prints" are in correct brackets i believe but i'm totally lost on the "if" and "else" statements.</p>
  
  <pre><code>class pdfPositionHandling:
  
      def parse_obj(self, lt_objs):
  
          # loop over the object list
          for obj in lt_objs:
  
              if isinstance(obj, pdfminer.layout.LTTextLine):
                  print ("%6d, %6d, %s" % (obj.bbox[0], obj.bbox[1], obj.get_text().replace('\n', '_'))
  
              # if it's a textbox, also recurse
              if isinstance(obj, pdfminer.layout.LTTextBoxHorizontal):
                  self.parse_obj(obj._objs)
  
              # if it's a container, recurse
              elif isinstance(obj, pdfminer.layout.LTFigure):
                  self.parse_obj(obj._objs)
  
      def parsepdf(self, filename, startpage, endpage):
  
          # Open a PDF file.
          fp = open(filename, 'rb')
  
          # Create a PDF parser object associated with the file object.
          parser = PDFParser(fp)
  
          # Create a PDF document object that stores the document structure.
          # Password for initialization as 2nd parameter
          document = PDFDocument(parser)
  
          # Check if the document allows text extraction. If not, abort.
          if not document.is_extractable:
              raise PDFTextExtractionNotAllowed
  
          # Create a PDF resource manager object that stores shared resources.
          rsrcmgr = PDFResourceManager()
  
          # Create a PDF device object.
          device = PDFDevice(rsrcmgr)
  
          # BEGIN LAYOUT ANALYSIS
          # Set parameters for analysis.
          laparams = LAParams()
  
          # Create a PDF page aggregator object.
          device = PDFPageAggregator(rsrcmgr, laparams=laparams)
  
              # Create a PDF interpreter object.
          interpreter = PDFPageInterpreter(rsrcmgr, device)
  
  
          i = 0
          # loop over all pages in the document
          for page in PDFPage.create_pages(document):
              if i &gt;= startpage and i &lt;= endpage:
                  # read the page into a layout object
                  interpreter.process_page(page)
                  layout = device.get_result()
  
                  # extract text from this object
                  self.parse_obj(layout._objs)
              i += 1
  </code></pre>
  
  <p>I get the following error:</p>
  
  <pre><code>File "C:/Users/951298/Documents/Python Scripts/PDF Scraping/untitled1.py", line 12
      if isinstance(obj, pdfminer.layout.LTTextBoxHorizontal):
                                                             ^
  SyntaxError: invalid syntax
  </code></pre>
  
  <p>Not sure why its point at the colon at the end?</p>