Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversion fails if label has language and choice_filter is used #355

Closed
yanokwa opened this issue Aug 30, 2019 · 6 comments · Fixed by #365
Closed

Conversion fails if label has language and choice_filter is used #355

yanokwa opened this issue Aug 30, 2019 · 6 comments · Fixed by #365

Comments

@yanokwa
Copy link
Contributor

yanokwa commented Aug 30, 2019

This is a regression with v0.15.0 and I suspect the problem is #287.

Here's the form in question.
test.xlsx

Fails
If I have a question with the proper label and a choice_filter, it fails.

Screen Shot 2019-08-30 at 10 20 05 AM

Traceback (most recent call last):
  File "/usr/local/bin/xls2xform", line 10, in <module>
    sys.exit(main_cli())
  File "/usr/local/lib/python2.7/site-packages/pyxform/xls2xform.py", line 175, in main_cli
    enketo=args.enketo_validate,
  File "/usr/local/lib/python2.7/site-packages/pyxform/xls2xform.py", line 48, in xls2xform_convert
    enketo=enketo,
  File "/usr/local/lib/python2.7/site-packages/pyxform/survey.py", line 899, in print_xform_to_file
    raise error
IndexError: list index out of range

Works

If I have I change to choice-filter choice-filter or label::English (en), then it works.

Screen Shot 2019-08-30 at 10 20 27 AM

Screen Shot 2019-08-30 at 10 23 06 AM

@yanokwa
Copy link
Contributor Author

yanokwa commented Aug 30, 2019

@KeynesYouDigIt I think your PR is the cause of this regression. Can you see if you can reproduce and fix?

@lognaturel
Copy link
Contributor

I think we should revert #287. I have a narrow fix for this crash at master...lognaturel:pyxform-355 but the more I dig into the behavior of #287, the more I think it will be confusing to users.

For example, see test test_missing_translation_no_default_lang_media_has_no_language. The error message that form produces is:

Missing field translations found for English (en) field may not appear as expected.
--
Question missing translation: /pyxform_autotestname/nums
Column missing: image Default language not set, with missing default translations. Please consider setting a default_language in your settings tab to insure questions and options appear as expected.
--
Question missing translation: /pyxform_autotestname/nums
Column missing: long

I think this is an extremely confusing message. I think we should start by designing the desired user experience for #157 before building it. The error messages and the cases in which they're displayed should be clear. The tests should verify that the expected messages are displayed, not just the count of error messages.

@KeynesYouDigIt
Copy link
Contributor

Sorry missed this thread somehow, looking at a patch now

@KeynesYouDigIt
Copy link
Contributor

I re added my changes but can't reproduce this issue, the test form converts fine. Is there something specific I did differenly in the form I cnverted? Or were you running a command other than

╰─$ python pyxform/xls2xform.py ~/Documents/issue355.xlsx ~/Documents/issue355.xml                                                                                                                                          127 ↵

Heres the form I ran this on


type | name | label::English (en) | choice_filter
-- | -- | -- | --
select_one country | country | Country |  
select_one region | region | Region | pais=${country}

@KeynesYouDigIt
Copy link
Contributor

Python2 just throws a seperate error

(pyxform) ╭─vince@fenrir ~/ODK/pyxform  ‹Vince_issue_157*› 
╰─$ python2 pyxform/xls2xform.py ~/Documents/issue355.xlsx ~/Documents/issue355.xml
Traceback (most recent call last):
  File "pyxform/xls2xform.py", line 14, in <module>
    from pyxform import builder, xls2json
ImportError: No module named pyxform

@KeynesYouDigIt
Copy link
Contributor

Having trouble reproducing this error, here is the test I am using
https://opendatakit.slack.com/archives/C51N25NSE/p1585434315000700

I am going to go forward with a 'safer' fix and PR soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants