The error ValueError: Circular reference detected is raised when trying to convert an XLSForm with multiple languages to JSON after running the to_xml function.
from pyxform.tests_v1.pyxform_test_case import PyxformTestCase
class TestConvertSurveyToJSON(PyxformTestCase):
def test_able_to_convert_to_JSON(self):
md = """
| survey |
| | type | name | label:Eng | label:Fr |
| | text | name | Name | Prénom |
| | select_multiple fruits | fruit | Fruit | Fruit |
| | | | | |
| choices | list name | name | label:Eng | label:Fr |
| | fruits | 1 | Mango | Mangue |
| | fruits | 2 | Orange | Orange |
| | fruits | 3 | Apple | Pomme |
"""
survey = self.md_to_pyxform_survey(
md_raw=md,
kwargs={"id_string": "id", "name": "multi-language", "title": "some-title"},
autoname=False,
)
survey.to_xml()
survey.to_json()
Expected behavior
Forms with multiple languages should be converted to JSON correctly.
Other information
Stack trace:
_Tried removing the _translations key and that seemed to fix the Circular import error; I believe the parent keys in the _translations dict may be raising the error._
Things you tried, stack traces, related issues, suggestions on how to fix it...
Software and hardware versions
pyxform v1.3.4
Problem description
The error
ValueError: Circular reference detected
is raised when trying to convert an XLSForm with multiple languages to JSON after running theto_xml
function.Steps to reproduce the problem
XLSForm
Expected behavior
Forms with multiple languages should be converted to JSON correctly.
Other information
Stack trace:
_Tried removing the
_translations
key and that seemed to fix the Circular import error; I believe theparent
keys in the_translations
dict may be raising the error._ Things you tried, stack traces, related issues, suggestions on how to fix it...