title: LookupError: unknown encoding: cp0
body: <p>I am on window 7, python 2.7.2, pandas 0.11.0, django 1.4, wsgi and apache 2.2.  I have a pandas script that works fine if I run it directly with python and also works in ipython with %run.  However, when I run pandas in my view i get "LookupError: unknown encoding: cp0".  This only happens when using ols in pandas within the view.  I'm also a little confused why py3compat.py is entering the picture as i'm using python 2.7. Also, I have seen some posts about wrapping a printed variable in a str(), but I'm not sure how that would apply here. The whole traceback is:</p>
  
  <pre><code>Traceback (most recent call last):
  model = pd.ols(y=df_loan['LogSpread'], x=df_loan['Dummy Rating'])
  File "C:\\Python27\\lib\\site-packages\\pandas\\stats\\interface.py", line 135, in ols
  return klass(**kwargs)
  File "C:\\Python27\\lib\\site-packages\\pandas\\stats\\ols.py", line 43, in __init__
    import statsmodels.api as sm
  File "C:\\Python27\\lib\\site-packages\\statsmodels-0.5.0-py2.7-win32.egg\\statsmodels\\api.py", line 3, in &lt;module&gt;
    import regression
  File "C:\\Python27\\lib\\site-packages\\statsmodels-0.5.0-py2.7-win32.egg\\statsmodels\\regression\\__init__.py", line 1, in &lt;module&gt;
    from linear_model import yule_walker
  File "C:\\Python27\\lib\\site-packages\\statsmodels-0.5.0-py2.7-win32.egg\\statsmodels\\regression\\linear_model.py", line 41, in &lt;module&gt;
    import statsmodels.base.model as base
  File "C:\\Python27\\lib\\site-packages\\statsmodels-0.5.0-py2.7-win32.egg\\statsmodels\\base\\model.py", line 10, in &lt;module&gt;
  from statsmodels.formula import handle_formula_data
  File "C:\\Python27\\lib\\site-packages\\statsmodels-0.5.0-py2.7-win32.egg\\statsmodels\\formula\\__init__.py", line 4, in &lt;module&gt;
    from formulatools import handle_formula_data
  File "C:\\Python27\\lib\\site-packages\\statsmodels-0.5.0-py2.7-win32.egg\\statsmodels\\formula\\formulatools.py", line 2, in &lt;module&gt;
    from patsy import dmatrices
  File "build\\bdist.win32\\egg\\patsy\\__init__.py", line 70, in &lt;module&gt;
    _reexport("patsy." + child)
  File "build\\bdist.win32\\egg\\patsy\\__init__.py", line 61, in _reexport
  __import__(modname)
  File "build\\bdist.win32\\egg\\patsy\\highlevel.py", line 18, in &lt;module&gt;
  File "build\\bdist.win32\\egg\\patsy\\design_info.py", line 17, in &lt;module&gt;
  File "build\\bdist.win32\\egg\\patsy\\util.py", line 385, in &lt;module&gt;
  File "C:\\Python27\\lib\\site-packages\\ipython-0.13.1-py2.7.egg\\IPython\\__init__.py", line 46, in &lt;module&gt;
    from .frontend.terminal.embed import embed
  File "C:\\Python27\\lib\\site-packages\\ipython-0.13.1-py2.7.egg\\IPython\\frontend\\terminal\\embed.py", line 39, in &lt;module&gt;
    from IPython.frontend.terminal.interactiveshell import TerminalInteractiveShell
  File "C:\\Python27\\lib\\site-packages\\ipython-0.13.1-py2.7.egg\\IPython\\frontend\\terminal\\interactiveshell.py", line 33, in &lt;module&gt;
    from IPython.core.interactiveshell import InteractiveShell, InteractiveShellABC
  File "C:\\Python27\\lib\\site-packages\\ipython-0.13.1-py2.7.egg\\IPython\\core\\interactiveshell.py", line 61, in &lt;module&gt;
    from IPython.core.prompts import PromptManager
  File "C:\\Python27\\lib\\site-packages\\ipython-0.13.1-py2.7.egg\\IPython\\core\\prompts.py", line 138, in &lt;module&gt;
    HOME = py3compat.str_to_unicode(os.environ.get("HOME","//////:::::ZZZZZ,,,~~~"))
  File "C:\\Python27\\lib\\site-packages\\ipython-0.13.1-py2.7.egg\\IPython\\utils\\py3compat.py", line 18, in decode
    return s.decode(encoding, "replace")
  LookupError: unknown encoding: cp0
  </code></pre>
  
  <p>Thanks a bunch!</p>