Error while exporting data through API (CommCare Data Export Tool)

56 views
Skip to first unread message

Sahu

unread,
Sep 20, 2014, 8:45:36 AM9/20/14
to commcar...@googlegroups.com
Hi ,

I need yours support in resolving the issue for a setup to Export the CommCare by using the API to an Excel file:

I have configured a windows  based machine based on the information available in the URL   https://confluence.dimagi.com/display/commcarepublic/CommCare+Data+Export+Tool.

and  and i am getting stuck with an error in the 3rd step (Run the examples and save the output to an Excel Workbook) with the below command line:

C:\python27\scripts\commcare-export --output-format xlsx --output registrations-export-results.xlsx --project https://www.commcarehq.org/a/programme --query "C:\Documents and Settings\Admin\My Documents\Commcare\Pregnancy-Registration.xlsx"

The error is as follows:

Traceback (most recent call last):
  File "C:\python27\scripts\commcare-export-script.py", line 9, in <module>
    load_entry_point('commcare-export==0.11.7', 'console_scripts', 'commcare-exp
ort')()
  File "C:\Python27\lib\site-packages\commcare_export\cli.py", line 181, in entr
y_point
    main(sys.argv[1:])
  File "C:\Python27\lib\site-packages\commcare_export\cli.py", line 71, in main
    main_with_args(args)
  File "C:\Python27\lib\site-packages\commcare_export\cli.py", line 166, in main
_with_args
    writer.write_table(table)
  File "C:\Python27\lib\site-packages\commcare_export\writers.py", line 99, in w
rite_table
    for row in table['rows']:
  File "C:\Python27\lib\site-packages\commcare_export\minilinq.py", line 255, in
 iterate
    for item in source_result:
  File "C:\Python27\lib\site-packages\commcare_export\commcare_hq_client.py", li
ne 105, in iterate_resource
    batch = self.get(resource, params)
  File "C:\Python27\lib\site-packages\commcare_export\commcare_hq_client.py", li
ne 91, in get
    raise Exception('GET %s failed (%s): %s' % (resource_url, response.status_co
de, response.text))
Exception

Thanks in advance for your reply/suggestions.

With regards,
GD Sahu



Cory Zue

unread,
Sep 20, 2014, 10:09:15 AM9/20/14
to commcar...@googlegroups.com
Can you double check your project? That does not look like an existing project space on HQ.

--
You received this message because you are subscribed to the Google Groups "commcare-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to commcare-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Simon Kelly

unread,
Sep 23, 2014, 5:23:30 AM9/23/14
to commcar...@googlegroups.com
Hi Sahu

The project parameter should just be the name without the 'http://www.commcarehq.org/a/' so in your case it should just be 'programme' though I concur with Cory that there is not project space on CommCare HQ with that name.
--
Simon Kelly
Senior Engineer | Dimagi South Africa

Gurudayal Sahu

unread,
Sep 29, 2014, 12:12:13 PM9/29/14
to commcar...@googlegroups.com
Hi,

Thanks for all of your reply & suggestions.

Today while i tried to run the command " C:\python27\scripts\commcare-export --output-format xlsx --output registrations-export-results.xlsx --project crs --query demo-registrations.xlsx" now its flashing a diffirent error message as "IOError: [Errno 13] Permission denied: 'registrations-export-results.xlsx'".

I am not able to trace out the reasons for the above error message because as per the mail received from Commcarehq, there are still some of the web site parts are not accessible.

so kindly suggest me, if it is a known type of issue ?

With regards,
GD Sahu

Cory Zue

unread,
Sep 29, 2014, 1:47:15 PM9/29/14
to commcar...@googlegroups.com
Hello,

Yes, the partial outage is affecting almost all APIs and the data export tool. Please try this again when you see the uptime notice go back out and follow up if you're still experiencing issues.

Cory

Gurudayal Sahu

unread,
Sep 29, 2014, 2:08:32 PM9/29/14
to commcar...@googlegroups.com
Thanks Cory,

After changing the path of the output locaton to MyDocs the error is not getting repeated and now its able to create the output file also but it does not reflect any exported data.

After executing the command it display the message as "raise Exception('GET %s failed (%s): %s' % (resource_url, response.status_co
de, response.text)) Exception".

While cross checking the terms related configuration (resouce_url...etc.,) in the linking query excel file ,its seems to be fine as per the the requirements.

Kindly suggest for the further steps.

With regards,
Gurudayal Sahu


Cory Zue

unread,
Sep 29, 2014, 5:26:04 PM9/29/14
to commcare-developers, Gurudayal Sahu
Hi,

I think you were accessing while the APIs were still down. Can you confirm this is still happening now?

(I'm also taking this off the user list and switching it to the developer list. Please join the developer group and follow up there)

thanks,
Cory
Reply all
Reply to author
Forward
0 new messages