Unable to export using commcare-export Tool

Hi,

I was trying to export case data. i used the instruction from the following link: https://confluence.dimagi.com/display/commcarepublic/CommCare+Data+Export+Tool

Here is the steps i applied

1.I installed commcare-export on control machine
sudo pip install commcare-export
2. commcare-export --commcare-hq https://www.echisethiopia.org/a/fmoh-echis/ --output-format xlsx --output exports/reports.zip --project fmoh-echis --username mailtodemis08@gmail.com --password password

  1. i run it and it doesn’t see any output or error

Hi Demisew

Can you try add the --verbose flag which should give you more output.

commcare-export --commcare-hq https://www.echisethiopia.org/a/fmoh-echis/ --output-format xlsx --output exports/reports.zip --project fmoh-echis --username mailtodemis08@gmail.com --password ‘password’ --verbose

Output:
2019-12-20 12:05:16,172 commcare_export.cli INFO CommCare Export Version 1.2.1

Hi

Sorry for not noticing this before, you are missing the --query argument which should have a value of the path to your Excel query file. Without this the tool is waiting for you to provide the query via STDIN.

I will update the tool with clearer messaging.

:+1: :+1:

After added the --query argument, it successfully created the output file. but still displaying an error shown below

(ansible) ansible@echis0:~/exports$ commcare-export --commcare-hq https://www.echisethiopia.org/a/fmoh-echis/ --output-format xlsx --output exports/reports.zip --project fmoh-echis --username mailtodemis08@gmail.com --password ‘password’ --query query/demo-registrations.xlsx

File “/usr/local/lib/python2.7/dist-packages/commcare_export/env.py”, line 455, in emit_table
self.writer.write_table(table_spec)
File “/usr/local/lib/python2.7/dist-packages/commcare_export/writers.py”, line 130, in write_table
for row in table[‘rows’]:
File “/usr/local/lib/python2.7/dist-packages/commcare_export/env.py”, line 475, in _unwrap_row_vals
for row in rows:
File “/usr/local/lib/python2.7/dist-packages/commcare_export/minilinq.py”, line 262, in iterate
for item in source_result:
File “/usr/local/lib/python2.7/dist-packages/commcare_export/commcare_hq_client.py”, line 120, in iterate_resource
batch = self.get(resource, params)
File “/usr/local/lib/python2.7/dist-packages/backoff/_sync.py”, line 94, in retry
ret = target(*args, **kwargs)
File “/usr/local/lib/python2.7/dist-packages/commcare_export/commcare_hq_client.py”, line 104, in get
File “/usr/local/lib/python2.7/dist-packages/commcare_export/env.py”, line 455, in emit_table
self.writer.write_table(table_spec)
File “/usr/local/lib/python2.7/dist-packages/commcare_export/writers.py”, line 130, in write_table
for row in table[‘rows’]:
File “/usr/local/lib/python2.7/dist-packages/commcare_export/env.py”, line 475, in _unwrap_row_vals
for row in rows:
File “/usr/local/lib/python2.7/dist-packages/commcare_export/minilinq.py”, line 262, in iterate
for item in source_result:
File “/usr/local/lib/python2.7/dist-packages/commcare_export/commcare_hq_client.py”, line 120, in iterate_resource
batch = self.get(resource, params)
File “/usr/local/lib/python2.7/dist-packages/backoff/_sync.py”, line 94, in retry
ret = target(*args, *kwargs)
File “/usr/local/lib/python2.7/dist-packages/commcare_export/commcare_hq_client.py”, line 104, in get
response.raise_for_status()
File “/usr/local/lib/python2.7/dist-packages/requests/models.py”, line 940, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://www.echisethiopia.org/a/fmoh-echis//a/fmoh-echis/api/v0.5/form/?limit=100&order_by=server_modified_on&order_by=received_on&xmlns.exact=http%3A%2F%2Fopenrosa.org%2Fformdesigner%2Fdd3190c7dd7e9e7d469a9705709f2f6b4e27f1d8
(ansible) ansible@echis0:~$
[0] 0:bash
“echis0” 16:51 20-Dec-19
File “/usr/local/lib/python2.7/dist-packages/commcare_export/env.py”, line 455, in emit_table
self.writer.write_table(table_spec)
File “/usr/local/lib/python2.7/dist-packages/commcare_export/writers.py”, line 130, in write_table
for row in table[‘rows’]:
File “/usr/local/lib/python2.7/dist-packages/commcare_export/env.py”, line 475, in _unwrap_row_vals
for row in rows:
File “/usr/local/lib/python2.7/dist-packages/commcare_export/minilinq.py”, line 262, in iterate
for item in source_result:
File “/usr/local/lib/python2.7/dist-packages/commcare_export/commcare_hq_client.py”, line 120, in iterate_resource
batch = self.get(resource, params)
File “/usr/local/lib/python2.7/dist-packages/backoff/_sync.py”, line 94, in retry
ret = target(*args, **kwargs)
File “/usr/local/lib/python2.7/dist-packages/commcare_export/commcare_hq_client.py”, line 104, in get
response.raise_for_status()
File “/usr/local/lib/python2.7/dist-packages/requests/models.py”, line 940, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://www.echisethiopia.org/a/fmoh-echis//a/fmoh-echis/api/v0.5/form/?limit=100&order_by=server_modified_on&order_by=received_on&xmlns.exact=http%3A%2F%2Fopenrosa.org%2Fformdesigner%2Fdd3190c7dd7e9e7d469a9705709f2f6b4e27f1d8
File “/usr/local/lib/python2.7/dist-packages/commcare_export/env.py”, line 455, in emit_table
self.writer.write_table(table_spec)
File “/usr/local/lib/python2.7/dist-packages/commcare_export/writers.py”, line 130, in write_table
for row in table[‘rows’]:
File “/usr/local/lib/python2.7/dist-packages/commcare_export/env.py”, line 475, in _unwrap_row_vals
for row in rows:
File “/usr/local/lib/python2.7/dist-packages/commcare_export/minilinq.py”, line 262, in iterate
for item in source_result:
File “/usr/local/lib/python2.7/dist-packages/commcare_export/commcare_hq_client.py”, line 120, in iterate_resource
batch = self.get(resource, params)
File “/usr/local/lib/python2.7/dist-packages/backoff/_sync.py”, line 94, in retry
ret = target(*args, **kwargs)
File “/usr/local/lib/python2.7/dist-packages/commcare_export/commcare_hq_client.py”, line 104, in get
response.raise_for_status()
File “/usr/local/lib/python2.7/dist-packages/requests/models.py”, line 940, in raise_for_status
raise HTTPError(http_error_msg, response=self)
requests.exceptions.HTTPError: 404 Client Error: Not Found for url: https://www.echisethiopia.org/a/fmoh-echis//a/fmoh-echis/api/v0.5/form/?limit=100&order_by=server_modified_on&order_by=received_on&xmlns.exact=http%3A%2F%2Fopenrosa.org%2Fformdesigner%2Fdd3190c7dd7e9e7d469a9705709f2f6b4e27f1d8

I see the URL in the traceback contains /a/fmoh-echis//a/fmoh-echis/ - looks like that section of the path is added twice. I see you’re passing this to the command:

https://www.echisethiopia.org/a/fmoh-echis/

You might try dropping the last bit - instead querying

https://www.echisethiopia.org