CroatiaControlLtd/asterix

Exception: unexpected value type Raw (json-to-xml.py)

dongsin-kim opened this issue · 2 comments

Hi @zoranbosnjak and @dsalantic, I am so sorry for bothering you. I am starting to feeling guilty for reporting an issue on this repo.. ;)

I am trying to run the json-to-xml.py referred to this example and face this error.

Traceback (most recent call last):
File "json-to-xml.py", line 708, in
cat.render()
File "json-to-xml.py", line 647, in render
i.render()
File "json-to-xml.py", line 613, in render
Variation.create(self, item).render()
File "json-to-xml.py", line 392, in realRender
self.oldRender()
File "json-to-xml.py", line 413, in render
Bits(self, item, bitsFrom, bitsTo).render()
File "json-to-xml.py", line 322, in render
renderRule(content, case0, case1, case2)
File "json-to-xml.py", line 76, in renderRule
return caseContextFree(rule)
File "json-to-xml.py", line 308, in case1
raise Exception('unexpected value type {}'.format(t))
Exception: unexpected value type Raw

Please find the several steps for reproducing the error as follows:


Step0. check python version
python3 --version
(For me, the version is >> Python 3.8.10 <<)

Step1. download definition in .json format
curl https://zoranbosnjak.github.io/asterix-specs/specs/cat020/cats/cat1.10/definition.json > input.json

Step2. convert .json to .xml
python3 json-to-xml.py < input.json > output.xml


Unfortunately it seems that this module is outdated.
I didn't yet integrated latest changes from @zoranbosnjak.

@dsalantic
I have checked with your latest master... The generated-specs branch still merges cleanly. I would suggest to proceed with the following:

  1. Merge the generated-specs branch to your master. For your convenience, I have already performed the merge and sync. The result is in my clone, revision is b46fc9e. To avoid unnecessary branches, you could do it from the command line, something like:
# from clean repository, on master branch
git pull https://github.com/zoranbosnjak/asterix.git
git push ...

This step is safe. All the changes are in the asterix-specs-converter/ directory. This would fix the reported problem.

  1. Gradually (maybe with additional commits) move the specs from asterix-specs-converter/specs to install/config. As far as I remember, some categories/editions still require review and I am well aware that it takes time. Let me know if there are any remaining problems.