Unrecognized arguments error when converting app forms

Hi there, I am getting an unrecognized arguments error when running convert-app-forms as shown below:

daudi@LAPTOP-5RIPOR8D /m/c/U/d/D/e/s/config-echis-2.0 (main)> cht --url=https://user:pass@localhost --accept-self-signed-certs convert-app-forms -- death_report
INFO Processing config in config-echis-2.0.
INFO Actions:
          convert-app-forms
INFO Starting action: convert-app-forms...
INFO Converting form /mnt/c/Users/david.njuguna/Desktop/eCHIS workshop/source code/config-echis-2.0/forms/app/death_report.xlsx....
usage: xls2xform-medic [-h] [--json] [--skip_validate]
          path_to_XLSForm output_path
xls2xform-medic: error: unrecognized arguments: code/config-echis-2.0/forms/app/death_report.xlsx /mnt/c/Users/david.njuguna/Desktop/
eCHIS workshop/source code/config-echis-2.0/forms/app/death_report.xml
INFO usage: xls2xform-medic [-h] [--json] [--skip_validate]
          path_to_XLSForm output_path
xls2xform-medic: error: unrecognized arguments: code/config-echis-2.0/forms/app/death_report.xlsx /mnt/c/Users/david.njuguna/Desktop/
eCHIS workshop/source code/config-echis-2.0/forms/app/death_report.xml
ERROR undefined
daudia LAPTOP-5RIPOR8D /m/c/U/d/D/e/s/config-echis-2.0 (main) [1]> 

Kindly help resolve this issue.

cht-conf version: 3.15.0
OS: Windows 11/WSL

I think this error is caused by the spaces in your directory path. /mnt/c/Users/david.njuguna/Desktop/eCHIS workshop/source code/config-echis-2.0/forms/app/death_report.xlsx.

Specifically the folder names “eCHIS workshop” and “source code”. I was able to recreate this error locally by updating the folder containing my config to also include a space. Hopefully you can resolve your error by updating those folder names (to something like “eCHIS_workshop” and “source_code”).

That being said, this is poor behavior and should also be fixed in cht-conf. I have logged:

1 Like

Thank you @jkuester, I’ll let you know how it goes. It worked after adding underscores. :confetti_ball:

Here is another screenshot to consider for the fix. There’s a mix of forward and back slashes in the path.

1 Like

Thank you @irene @jkuester for the highlight and resolution of this error. For future proofing could the convert-app-forms service accept URLs as strings encapsulated in quotes, for example in the path name given above, the path argument would be written as “/mnt/c/Users/david.njuguna/Desktop/eCHIS workshop/source code/config-echis-2.0/forms/app/death_report.xlsx”

@DavidKN yes! I expect the fix that is needed in cht-conf is something like this where we just make sure quote (and/or properly escape) the path before passing it to the xls2xform-medic utility.

@jkuester
I am converting app forms for our current project and I get the errors below:

  1. pyxform.errors.PyXFormError: Unknown question type ‘db:national_office’, from the county_edit form. I have the forms for creating national, county and sub county place, and get stuck when converting county_officer-edit form
  2. ERROR Invalid schedule settings: ValidationError: “value” must be an array from the base_settings json file

Will appreciate any feedback

@oyierphil for your first error, can you try switching to the new style of defining contact selectors in your form? I believe that the old style of using

type appearance
db:national_office db-object

does not work with custom place types (like national_office) but only with the built-in clinic , health_center , district_hospital, and person. To select a contact with a custom type, you should be able to use:

type appearance
string select-contact type-national_office

@oyierphil regarding the second error, you should review your config for schedules and verify that it has the expected structure. (Specifically, I wonder if you may have set schedules to be an object instead of an array…)

@jkuester
I reviewed the documentation and made changes on the configs, the errors were resolved, but have new errors on some forms for places. Sorting them out tomorrow then testing, will update if everything works

1 Like

@jkuester
Sorted the issues with the forms and now testing on our test server. I get the error below when I run the command to convert and upload forms:
ERROR Failed to get a response from https://XXXX:****@X.X.X.X/XXXX/. Maybe you entered the wrong URL, wrong port or the instance is not started. Please check and try again.

Both containers are running, I can ping the VM and get response. I noted the docker-compose.yml was missing from the project folder today, downloading using curl command brought a 404 error, thus had to edit the contents of the file manually., start the containers and try again to convert the files,will appreciate your insights

Ah, yes @oyierphil, assuming you are working with a 3.x version of the CHT (and are not trying to test with the upcoming 4.0 architecture) then you should probably user this link: https://raw.githubusercontent.com/medic/cht-core/3.16.0/docker-compose.yml and load the file from the 3.16.0 tag. The master branch has now been updated with the new architecture changes coming in 4.0.0 and that involves significant changes to the docker-compose configurations…

Also, in regards to your previously mentioned error, I cannot tell from that bit of logs exactly what might be causing the issue, but one thing to check would be your port mapping. Is the CHT test instance exposed on 443 or on a different port? (It does not look like you are using an alternative port in your url connection string.) Is that port open and accepting traffic through the firewall?

@jkuester
It was the version of docker-compose.yml that I downloaded online that was creating the error, I followed a post by Diana on the same and loaded the correct version, working now

2 Likes