baloo/sphinx-ditaa

building ceph's document produce name 'unicode' is not defined

Closed this issue · 2 comments

seem like the script can't deal with python 3?

Procedure to reproduce the problem

cd ~/ceph
admin/build-doc

Error logs / results:

Exception occurred:

  File "***/ceph/build-doc/virtualenv/src/sphinx-ditaa/sphinxcontrib/ditaa.py", line 118, in render_ditaa
    if isinstance(code, unicode):
NameError: name 'unicode' is not defined

Reproducible project: https://github.com/ceph/ceph

baloo commented

nope.
https://github.com/baloo/sphinx-ditaa/blob/master/sphinxcontrib/ditaa.py#L119


    # ditaa expects UTF-8 by default
    # In Python 3, all strings are sequences of Unicode characters.
    if sys.version_info < (3, 0):
        if isinstance(code, unicode):
            code = code.encode('utf-8')
    else:
        if isinstance(code, str):
            code = code.encode('utf-8')
baloo commented

(just upgrade your version of sphinx-ditaa)