boisgera/pandoc

ValueError: pandoc 2.11.4 is not registered

Closed this issue · 3 comments

What does this mean and how to solve this issue?

KeyError: '2.11.4'

During handling of the above exception, another exception occurred:

ValueError                                Traceback (most recent call last)
~/dev/testarea_dc/ex_6.py in <module>
     10 soup = create_soup('software_engineering_ch1_ex6.txt')
     11 ex = get_exercise(soup)
---> 12 contents = get_content(ex)
     13 
     14 with open('ex_6.md', 'w+') as f:

~/dev/testarea_dc/dc_exercises.py in get_content(soup, selector)
     44             print('\n', cont_prett)
     45             # pandoc convert
---> 46             doc = pandoc.read(cont.text, format='html')
     47             cont_prett2 = simplify(doc)
     48             print(pandoc.write(cont_prett2, format="markdown", options=["-s"]))

~/bin/miniconda/envs/SCRAP/lib/python3.7/site-packages/pandoc/__init__.py in read(source, file, format, options)
    256 def read(source=None, file=None, format=None, options=None):
    257     if configure(read=True) is None:
--> 258         configure(auto=True)
    259     if options is None:
    260         options = []

~/bin/miniconda/envs/SCRAP/lib/python3.7/site-packages/pandoc/__init__.py in configure(auto, path, version, pandoc_types_version, read, reset)
    118 
    119     if version is not None:
--> 120         found_pandoc_types_versions = utils.resolve(version)
    121         if pandoc_types_version is None:
    122             if len(found_pandoc_types_versions) >= 1:

~/bin/miniconda/envs/SCRAP/lib/python3.7/site-packages/pandoc/utils.py in resolve(version)
     56     except KeyError:
     57         error = "pandoc {0} is not registered"
---> 58         raise ValueError(error.format(version))
     59     pandoc_types_versions = sorted(definitions.keys(), key=version_key)
     60 

ValueError: pandoc 2.11.4 is not registered

The latest "registered" pandoc version is 2.9.2.1 at the moment (see https://github.com/boisgera/pandoc/blob/master/src/pandoc/pandoc-types.js). At this point in history, the pandoc project (https://pandoc.org/) changed significantly its json serialization conventions and the structure of its data model. Some (undocumented) invariants that held for a long time are no more satisfied and unfortunately we relied on those ; see #20 for some details.

At this stage, I lack the bandwidth to analyze these upstream changes and see what can/should be done for this project to be compatible with the more recent versions. So, at the moment unfortunately, you need to install an older version of pandoc (the command-line tool) to be able to use this library. (I would recommend installing an older pandoc inside a conda environment, if this is a realistic option for you.)

Cheers,

SB

Update (upstream) : issue (jgm/pandoc-types#75) has been closed and the corresponding changes performed in pandoc-types 1.22 (see jgm/pandoc-types#76). This version of pandoc-types is used in pandoc 2.11.x (but not 2.10.x).

It should be fine now ; the 2.10.x version are not supported, but 2.11.x is.