I am trying to import Data via command Line but getting error.
I have used the template from data import tool as well as the data export tool. But I am getting error
This is my command
bench --site {site_name} data-import --file ~/home/frappe/frappe-bench/Lead.csv --doctype Lead
and this error I am getting
Traceback (most recent call last):
File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
exec(code, run_globals)
File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 109, in <module>
main()
File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 18, in main
click.Group(commands=commands)(prog_name="bench")
File "/home/frappe/frappe-bench/env/lib/python3.10/site-packages/click/core.py", line 829, in __call__
return self.main(*args, **kwargs)
File "/home/frappe/frappe-bench/env/lib/python3.10/site-packages/click/core.py", line 782, in main
rv = self.invoke(ctx)
File "/home/frappe/frappe-bench/env/lib/python3.10/site-packages/click/core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/frappe/frappe-bench/env/lib/python3.10/site-packages/click/core.py", line 1259, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/frappe/frappe-bench/env/lib/python3.10/site-packages/click/core.py", line 1066, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/frappe/frappe-bench/env/lib/python3.10/site-packages/click/core.py", line 610, in invoke
return callback(*args, **kwargs)
File "/home/frappe/frappe-bench/env/lib/python3.10/site-packages/click/decorators.py", line 21, in new_func
return f(get_current_context(), *args, **kwargs)
File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/__init__.py", line 29, in _func
ret = f(frappe._dict(ctx.obj), *args, **kwargs)
File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/utils.py", line 463, in data_import
import_file(doctype, file_path, import_type, submit_after_import, console=True)
File "/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/data_import/data_import.py", line 203, in import_file
i = Importer(doctype=doctype, file_path=file_path, data_import=data_import, console=console)
File "/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/data_import/importer.py", line 43, in __init__
self.import_file = ImportFile(
File "/home/frappe/frappe-bench/apps/frappe/frappe/core/doctype/data_import/importer.py", line 413, in __init__
frappe.throw(_("Invalid template file for import"))
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 534, in throw
msgprint(
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 502, in msgprint
_raise_exception()
File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 451, in _raise_exception
raise raise_exception(msg)
frappe.exceptions.ValidationError: Invalid template file for import
Any help would be greatly appreciated.
old command which is this bench --site {{site_name}} import-csv ~/home/frappe/frappe-bench/Lead.csv
is deprecated