Discussion:
[Docutils-users] Python 3.4 StandardError problem
Vladimir Prus
2015-06-02 06:48:20 UTC
Permalink
Hi,

I'm trying to use docutils on Windows, with Python 3.4, and I get an error like this:

Traceback (most recent call last):
File "C:/Users/Vladimir/Local/docutils-0.12/tools/rst2html.py", line 17, in <module>
from docutils.core import publish_cmdline, default_description
File "C:\Users\Vladimir\Local\docutils-0.12\docutils\__init__.py", line 68, in <module>
class ApplicationError(StandardError):
NameError: name 'StandardError' is not defined

The command line is nothing interesting:

"C:\Python34\python" "C:/Users/Vladimir/Local/docutils-0.12/tools/rst2html.py" --link-stylesheet
--traceback --trim-footnote-reference-space --footnote-references=superscript --stylesheet=../../rst.css
unix-variants.rst ..\..\bin.v2\more\getting_started\msvc-12.0\debug\threading-multi\unix-variants.html

I have tried both 0.12 release and the latest snapshot as of today, whose RELEASE-NOTES.txt say:

:Date: $Date: 2015-03-15 17:16:30 +0000 (Sun, 15 Mar 2015) $
:Revision: $Revision: 7837 $

Is there anything I'm doing wrong, or shall I use earlier version of Python, or is it possible
to fix this problem?

Thanks in advance,
Volodya
Aahz
2015-06-02 21:49:47 UTC
Permalink
Post by Vladimir Prus
File "C:/Users/Vladimir/Local/docutils-0.12/tools/rst2html.py", line 17, in <module>
from docutils.core import publish_cmdline, default_description
File "C:\Users\Vladimir\Local\docutils-0.12\docutils\__init__.py", line 68, in <module>
NameError: name 'StandardError' is not defined
This looks like an improper 2to3 conversion:

https://docs.python.org/3/library/2to3.html#2to3fixer-standarderror

I haven't really used Python3 yet, so I have no idea what's going on,
just felt like testing my research skills. ;-)
--
Aahz (***@pythoncraft.com) <*> http://www.pythoncraft.com/

"Times are bad. Children no longer obey their parents, and everyone is
writing a book." --Cicero
Guenter Milde
2015-06-03 12:31:40 UTC
Permalink
Post by Vladimir Prus
Hi,
File "C:/Users/Vladimir/Local/docutils-0.12/tools/rst2html.py", line 17, in <module>
from docutils.core import publish_cmdline, default_description
File "C:\Users\Vladimir\Local\docutils-0.12\docutils\__init__.py", line 68, in <module>
NameError: name 'StandardError' is not defined
It looks like you are trying to use the Python 2 version with Python 3.

The Py3 code has

class ApplicationError(Exception):

on line 68 of docutils/__init__.py
Post by Vladimir Prus
Is there anything I'm doing wrong, or shall I use earlier version of
Python, or is it possible to fix this problem?
To use Docutils with Python 3, you need to install it:

* unpack and call setup.py with a py3 version, or
* use pip to download and install a pre-build "Wheel" from the Pypi.

See also http://docutils.sourceforge.net/README.html#python-3-compatibility

Günter
Vladimir Prus
2015-06-03 20:01:14 UTC
Permalink
Hi Günter,
Post by Guenter Milde
Post by Vladimir Prus
NameError: name 'StandardError' is not defined
It looks like you are trying to use the Python 2 version with Python 3.
The Py3 code has
on line 68 of docutils/__init__.py
Yep, you're right.
Post by Guenter Milde
Post by Vladimir Prus
Is there anything I'm doing wrong, or shall I use earlier version of
Python, or is it possible to fix this problem?
* unpack and call setup.py with a py3 version, or
This worked for me. Thanks for catching my mistake!

- Volodya



------------------------------------------------------------------------------
Loading...