title: Python filename, not markup. open this file and pass the filehandle into Beautiful Soup
body: <p>I have changed my Python 2.7 routine to accept a file path as a parameter for the routine so I don't have to duplicate code by inserting multiple file paths inside the method.</p>
  
  <p>When my method is called I get the following error:</p>
  
  <pre><code>looks like a filename, not markup. You should probably open this file and pass the filehandle into Beautiful Soup.
    '"%s" looks like a filename, not markup. You should probably open this file and pass the filehandle into Beautiful Soup.' % markup)
  </code></pre>
  
  <p>My method implementation is:</p>
  
  <pre><code>def extract_data_from_report3(filename):
      html_report_part1 = open(filename,'r').read()
      soup = BeautifulSoup(filename, "html.parser")
      th = soup.find_all('th')
      td = soup.find_all('td')
  
      headers = [header.get_text(strip=True) for header in soup.find_all("th")]
      rows = [dict(zip(headers, [td.get_text(strip=True) for td in row.find_all("td")]))
          for row in soup.find_all("tr")[1:-1]]
      print(rows)
      return rows
  </code></pre>
  
  <p>To call the method is as follows:</p>
  
  <pre><code>rows_part1 =  report.extract_data_from_report3(r"E:\test_runners\selenium_regression_test_5_1_1\TestReport\SeleniumTestReport_part1.html")
  print "part1 = "
  print rows_part1
  </code></pre>
  
  <p>How can I pass the file name as a parameter?</p>