Try ERPNext Try Frappe Cloud Buy Support Partners Foundation

Cannot download an import template via the API

Hello all

I’m trying to download an import template using the

frappe.core.doctype.data_import.data_import.download_template

RPC method. But for some reason I keep getting this error

AttributeError: 'NoneType' object has no attribute 'items'

I’m trying these invocations

bench execute frappe.core.doctype.data_import.data_import.download_template --args ‘[“User”]’

bench execute frappe.core.doctype.data_import.data_import.download_template --kwargs ‘{“doctype”:“User”}’

Referring to the list of RPC methods by @revant_one at https://gist.github.com/revant/c2198c53673119e7020409764cf54a8c I also notice that the download_template has no definition of it’s arguments, unlike all the other methods.

Here is the actual code. Pass the parameters accordingly.

Thanks @rtdany10

Yes I tried passing additional parameters as per this function definition. However only the doctype is mandatory. Even so, I still get the same error. Can you execute this bench command?

Not sure if you can run it through bench, doesn’t it return a CSV file? Try running it through a browser.

Invoking the below method in the browser’s address bar

http://192.168.56.2/api/method/frappe.core.doctype.data_import.data_import.download_template?doctype="User"

also returns an error

Screenshot%20at%202021-06-08%2010-19-36

Trying with more arguments also does not work

http://192.168.56.2/api/method/frappe.core.doctype.data_import.data_import.download_template?doctype=“User”&file_type=“CSV”&export_records=“blank_template”&export_fields=’{“User”:[“name”]}’

Ran using frappe.call, same error.
Here is the log.
image
Will try to debug once I’m free.