title: Problems running beautifulsoup4 within Apache/mod_python/Django
body: <p>I'm was trying to render an HTML-page on the fly using BeautifulSoup version 4 in Django (using Apache2 with mod_python).
  However, as soon as I pass any HTML-string to the BeautifulSoup constructor (see code below), the browser just hangs waiting for the webserver. I tried equivalent code in CLI and it works like a charm. So I'm guessing it's something related to BeautifulSoups environment, in this case Django + Apache + mod_python.</p>
  
  <pre><code>import bs4
  import django.shortcuts as shortcuts
  
  def test(request):
      s = bs4.BeautifulSoup('&lt;b&gt;asdf&lt;/b&gt;')
      return shortcuts.render_to_response('test.html', {})
  </code></pre>
  
  <p>I have installed BeautifulSoup using pip, <code>pip install beautifulsoup4</code>. I tried to install BeautifulSoup3 using standard Debian packages, <code>apt-get install python-beautifulsoup</code>, and then the following equivalent code works fine (both from browser and CLI).</p>
  
  <pre><code>from BeautifulSoup import BeautifulSoup
  import django.shortcuts as shortcuts
  
  def test(request):
      s = BeautifulSoup('&lt;b&gt;asdf&lt;/b&gt;')
      return shortcuts.render_to_response('test.html', {})
  </code></pre>
  
  <p>I have looked in Apaches access and error logs and they show no information what's happening to the request that gets stalled. I have also checked /var/log/syslog and /var/log/messages, but no further info.</p>
  
  <p>Here's the Apache configuration I used:</p>
  
  <pre><code>&lt;VirtualHost *:80&gt;
      DocumentRoot /home/nandersson/src
      &lt;Directory /home/nandersson/src&gt;
          SetHandler python-program
          PythonHandler django.core.handlers.modpython
          SetEnv DJANGO_SETTINGS_MODULE app.settings
          PythonOption django.root /home/nandersson/src
          PythonDebug On
          PythonPath "['/home/nandersson/src'] + sys.path"
      &lt;/Directory&gt;
  
      &lt;Location "/media/"&gt;
          SetHandler None
      &lt;/Location&gt;
      &lt;Location "/app/poc/"&gt;
          SetHandler None
      &lt;/Location&gt;
  &lt;/VirtualHost&gt;
  </code></pre>
  
  <p>I'm not sure how to debug this further, not sure if it's a bug or not.
  Anyone got ideas on how to get to the bottom of this or have run into similar problems?</p>