[IPython-dev] Invalid cp0 encoding
Dave Hirschfeld
dave.hirschfeld at gmail.com
Tue Sep 3 10:08:40 EDT 2013
Just pinging the list to mention my attempt at a PR
(https://github.com/ipython/ipython/pull/4163) to fix the error I was
encountering below.
Whilst trying out rendering notebooks in a flask app under Apache on Windows
I got the below error when simply trying to import `SlidesExporter`:
```
mod_wsgi (pid=6260): Exception occurred processing WSGI script
'flask_test.wsgi'.
Traceback (most recent call last):
File "flask_test.py", line 81, in render_notebook
from IPython.nbconvert.exporters import SlidesExporter
File "c:\\dev\\code\\ipython\\IPython\\__init__.py", line 47, in <module>
from .terminal.embed import embed
File "c:\\dev\\code\\ipython\\IPython\\terminal\\embed.py", line 32, in
<module>
from IPython.terminal.interactiveshell import TerminalInteractiveShell
File "c:\\dev\\code\\ipython\\IPython\\terminal\\interactiveshell.py",
line 25, in <module>
from IPython.core.interactiveshell import InteractiveShell,
InteractiveShellABC
File "c:\\dev\\code\\ipython\\IPython\\core\\interactiveshell.py", line
59, in <module>
from IPython.core.prompts import PromptManager
File "c:\\dev\\code\\ipython\\IPython\\core\\prompts.py", line 138, in
<module>
HOME =
py3compat.str_to_unicode(os.environ.get("HOME","//////:::::ZZZZZ,,,~~~"))
File "c:\\dev\\code\\ipython\\IPython\\utils\\py3compat.py", line 18, in
decode
return s.decode(encoding, "replace")
LookupError: unknown encoding: cp0
```
NB: Although it now works great I have no idea what the second argument
returned by `SlidesExporter.from_filename` is or is for. Is there any
documentation on this?
```
In [34]: html, resources = exporter.from_filename('testnotebook.ipynb')
In [35]: type(resources)
Out[35]: IPython.nbconvert.exporters.exporter.ResourcesDict
In [36]: resources.keys()
Out[36]: ['reveal', 'inlining', 'output_extension', 'metadata']
In [37]: print IPython.sys_info()
{'codename': 'An Afternoon Hack',
'commit_hash': 'ee40094',
'commit_source': 'repository',
'default_encoding': 'cp1252',
'ipython_path': 'c:\\dev\\code\\ipython\\IPython',
'ipython_version': '2.0.0-dev',
'os_name': 'nt',
'platform': 'Windows-2008ServerR2-6.1.7601-SP1',
'sys_executable': 'C:\\dev\\bin\\Python27\\python.exe',
'sys_platform': 'win32',
'sys_version': '2.7.3 (default, Apr 10 2012, 23:24:47) [MSC v.1500 64 bit
(AMD64)]'}
```
Thanks,
Dave
More information about the IPython-dev
mailing list