title: problem with python imports (MySQLdb) and apache python_egg_cache
body: <p>I have trouble with php calling a python script, or its calling the script but stops somewhere on the way when trying to import MySQLdb</p>
  
  <p>now after adding, to my user .bash_profile, following this guide <a href="https://stackoverflow.com/questions/215267/how-do-you-fix-a-trac-installation-that-begins-giving-errors-relating-to-python-e/215298#215298">How do you fix a Trac installation that begins giving errors relating to PYTHON_EGG_CACHE?</a></p>
  
  <pre><code>export PYTHON_EGG_CACHE /var/www/html/path/cache
  </code></pre>
  
  <p>and to httpd.conf</p>
  
  <p></p>
  
  <pre><code>   AddHandler mod_python
     SetEnv PYTHON_EGG_CACHE /var/www/html/path/cache
  </code></pre>
  
  <p></p>
  
  <p>i still get this error message, the webserver still try to access /root/.python-eggs
  and i cant find my exported .python-eggs in my new folder</p>
  
  <pre><code>Array
  (
      [stdout] =&gt; 
      [stderr] =&gt; Traceback (most recent call last):
    File "/var/www/html/grndb/upscgenesearch/python/pythontest.py", line 4, in ?
      import MySQLdb
    File "build/bdist.linux-x86_64/egg/MySQLdb/__init__.py", line 19, in ?
    File "build/bdist.linux-x86_64/egg/_mysql.py", line 7, in ?
    File "build/bdist.linux-x86_64/egg/_mysql.py", line 4, in __bootstrap__
    File "/usr/lib/python2.4/site-packages/pkg_resources.py", line 799, in resource_filename
      return get_provider(package_or_requirement).get_resource_filename(
    File "/usr/lib/python2.4/site-packages/pkg_resources.py", line 1229, in get_resource_filename
      return self._extract_resource(manager, zip_path)
    File "/usr/lib/python2.4/site-packages/pkg_resources.py", line 1249, in _extract_resource
      real_path = manager.get_cache_path(
    File "/usr/lib/python2.4/site-packages/pkg_resources.py", line 880, in get_cache_path
      self.extraction_error()
    File "/usr/lib/python2.4/site-packages/pkg_resources.py", line 846, in extraction_error
      raise err
  pkg_resources.ExtractionError: Can't extract file(s) to egg cache
  </code></pre>
  
  <p>The following error occurred while trying to extract file(s) to the Python egg
  cache:</p>
  
  <pre><code> [Errno 13] Permission denied: '/root/.python-eggs'
  </code></pre>
  
  <p>The Python egg cache directory is currently set to:</p>
  
  <pre><code> /root/.python-eggs
  </code></pre>
  
  <p>Perhaps your account does not have write access to this directory?  You can
  change the cache directory by setting the PYTHON_EGG_CACHE environment
  variable to point to an accessible directory.</p>