title: BeautifulSoup hangs when using find
body: <p>I have a problem with the <code>bs4</code> package.   </p>
  
  <p>I have a <code>html</code> document, like this one:</p>
  
  <pre><code>data = """&lt;html&gt;&lt;head&gt;&lt;/head&gt;&lt;body&gt;
  &lt;p&gt; this is tab &lt;/p&gt;
  &lt;img src="image.jpg"&gt;
  &lt;/body&gt;&lt;/html&gt;
  """
  </code></pre>
  
  <p>This is my code:</p>
  
  <pre><code>from bs4 import BeautifulSoup
  soup = BeautifulSoup(data, 'html5lib')
  soup.find_all("a")
  </code></pre>
  
  <p>When I run it, <code>bs4</code> is still in a loop and doesn't return anything, maybe because in some <code>HTML</code> data the tag <code>a</code> doesn't exist.</p>
  
  <p>Many thanks.<br>
  1. Yes, above example working correctly.<br>
  2. But, in my case. data is a variable with multi lines html string</p>
  
  <pre><code>from bs4 import BeautifulSoup
  data = open("file.htm").read()
  soup = BeautifulSoup(data, 'html5lib')
  soup.find_all("a")
  </code></pre>
  
  <p>3. Please test with my file: <a href="https://mega.nz/#!GBRgjKBJ!OJxzCOlg65Uj8fSGkP2UEdHkPoKlHCN2O_nveZZivag" rel="nofollow">file.htm</a> <br>
  4. I'm using beautifulsoup4==4.4.1. Python 3.5.1 <br>
  5. Thanks again.</p>