Import csv error

67 views
Skip to first unread message

Bobby Hartanto

unread,
Sep 28, 2014, 6:52:43 AM9/28/14
to erpnext-dev...@googlegroups.com
Hi,



Just now im getting error :
list index out of range

when importing csv... why this is happen ?



Thanks

Bobby Hartanto

unread,
Sep 28, 2014, 10:34:09 PM9/28/14
to erpnext-dev...@googlegroups.com
Hi,


when im look at web console this error shown
"{u'operating_cost': 0.0, u'__islocal': 1, u'creation': '2014-09-29 09:30:58.666483', u'doctype': u'BOM', u'rm_cost_as_per': u'Valuation Rate', u'owner': u'bobzz...@gmail.com', u'total_fixed_cost': 0.0, u'flat_bom_details': [], u'modified_by': u'bobzz...@gmail.com', u'total_cost': 0.0, u'total_variable_cost': 0.0, u'amended_from': None, u'docstatus': 0, u'buying_price_list': u'Standard Buying', u'uom': u'PRS', u'bom_materials': [{u'__islocal': 1, u'qty_consumed_per_unit': None, u'qty': 9.1, u'rate': 0.0, u'owner': u'bobzz...@gmail.com', u'modified_by': u'bobzz...@gmail.com', u'scrap': 0.0, u'amount': 0.0, u'stock_uom': u'SF', u'operation_no': u'APRON', u'docstatus': 0, u'creation': '2014-09-29 09:30:58.666483', u'description': u'COW LEA HARLEY 1.2-1.4 mm BLACK 89', u'parent': u'BOM/BIGONIA-517-s/001', u'item_code': u'11LEAHAROO0002', u'standard': 0.13, u'doctype': u'BOM Item', u'bom_no': None, u'name': '7698923b6f8fabbcd23ddcbfc66b023839b8a2e60266da47d3f4de52', u'idx': 1, u'modi"[…] frappe.min.js:310
"Traceback (innermost last):
  File "/home/sigma/frappe-bench/apps/frappe/frappe/core/page/data_import_tool/importer.py", line 211, in upload
    doc.insert()
  File "/home/sigma/frappe-bench/apps/frappe/frappe/model/document.py", line 144, in insert
    self.run_before_save_methods()
  File "/home/sigma/frappe-bench/apps/frappe/frappe/model/document.py", line 430, in run_before_save_methods
    self.run_method("validate")
  File "/home/sigma/frappe-bench/apps/frappe/frappe/model/document.py", line 412, in run_method
    return Document.hook(fn)(self, *args, **kwargs)
  File "/home/sigma/frappe-bench/apps/frappe/frappe/model/document.py", line 493, in composer
    return composed(self, method, *args, **kwargs)
  File "/home/sigma/frappe-bench/apps/frappe/frappe/model/document.py", line 476, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "/home/sigma/frappe-bench/apps/frappe/frappe/model/document.py", line 406, in <lambda>
    fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
  File "/home/sigma/frappe-bench/apps/erpnext/erpnext/manufacturing/doctype/bom/bom.py", line 31, in validate
    self.validate_materials()
  File "/home/sigma/frappe-bench/apps/erpnext/erpnext/manufacturing/doctype/bom/bom.py", line 199, in validate_materials
    if item[0]['is_manufactured_item'] == 'Yes':
 IndexError: list index out of range
" frappe.min.js:310
"{u'operating_cost': 0.0, u'__islocal': 1, u'creation': '2014-09-29 09:30:58.731704', u'doctype': u'BOM', u'rm_cost_as_per': u'Valuation Rate', u'owner': u'bobzz...@gmail.com', u'total_fixed_cost': 0.0, u'flat_bom_details': [], u'modified_by': u'bobzz...@gmail.com', u'total_cost': 0.0, u'total_variable_cost': 0.0, u'amended_from': None, u'docstatus': 0, u'buying_price_list': u'Standard Buying', u'uom': u'PRS', u'bom_materials': [{u'__islocal': 1, u'qty_consumed_per_unit': None, u'qty': 10.4, u'rate': 0.0, u'owner': u'bobzz...@gmail.com', u'modified_by': u'bobzz...@gmail.com', u'scrap': 0.0, u'amount': 0.0, u'stock_uom': u'SF', u'operation_no': u'APRON', u'docstatus': 0, u'creation': '2014-09-29 09:30:58.731704', u'description': u'COW LEA HARLEY 1.2-1.4 mm BLACK 89', u'parent': u'BOM/BIGONIA-517-l/001', u'item_code': u'11LEAHAROO0002', u'standard': 0.13, u'doctype': u'BOM Item', u'bom_no': None, u'name': '01fed038a3dac0b94103181e6b33089fc2ae4edcca64b2fc842754d0', u'idx': 1, u'mod"[…] frappe.min.js:310
"Traceback (innermost last):
  File "/home/sigma/frappe-bench/apps/frappe/frappe/core/page/data_import_tool/importer.py", line 211, in upload
    doc.insert()
  File "/home/sigma/frappe-bench/apps/frappe/frappe/model/document.py", line 144, in insert
    self.run_before_save_methods()
  File "/home/sigma/frappe-bench/apps/frappe/frappe/model/document.py", line 430, in run_before_save_methods
    self.run_method("validate")
  File "/home/sigma/frappe-bench/apps/frappe/frappe/model/document.py", line 412, in run_method
    return Document.hook(fn)(self, *args, **kwargs)
  File "/home/sigma/frappe-bench/apps/frappe/frappe/model/document.py", line 493, in composer
    return composed(self, method, *args, **kwargs)
  File "/home/sigma/frappe-bench/apps/frappe/frappe/model/document.py", line 476, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "/home/sigma/frappe-bench/apps/frappe/frappe/model/document.py", line 406, in <lambda>
    fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
  File "/home/sigma/frappe-bench/apps/erpnext/erpnext/manufacturing/doctype/bom/bom.py", line 31, in validate
    self.validate_materials()
  File "/home/sigma/frappe-bench/apps/erpnext/erpnext/manufacturing/doctype/bom/bom.py", line 199, in validate_materials
    if item[0]['is_manufactured_item'] == 'Yes':
 IndexError: list index out of range
"

please advise


thanks

Bobby Hartanto

unread,
Sep 28, 2014, 11:49:52 PM9/28/14
to erpnext-dev...@googlegroups.com
Hi,

im adding some custom code in bom.py to throw error before line 199 to see if the data is null or missing but i think its okay
Data item code 11LEAHAROO0002 data [{'ispurchaseitem': u'Yes', 'ismanufactureditem': u'No', 'name': u'11LEAHAROO0002', 'issubcontracteditem': u'No', 'stockuom': u'SF', 'lastpurchaserate': 0.0, 'docstatus': 0, 'defaultbom': None, 'isasset_item': u'No', 'description': u'COW LEA HARLEY 1.2-1.4 mm BLACK 89'}]

the data is shown
so im really confused about the error

Thanks



On Sunday, September 28, 2014 5:52:43 PM UTC+7, Bobby Hartanto wrote:

Anand Doshi

unread,
Sep 29, 2014, 12:04:53 AM9/29/14
to erpnext-dev...@googlegroups.com
Hi bobby,

The way you have entered data in the import template could be incorrect. Though the code could've handled the error in a better manner. There should be atleast one row for the BOM Material table. 

If you have already created atleast one BOM via a form, you can use the "Download with Data" option when downloading the template to get an idea of what a CSV with data should look like. 

Thanks,
anand. 

Sent from my phone
--
1. Please be kind and don't send large attachments
2. For issues, features requests use https://github.com/frappe/erpnext/issues
---
You received this message because you are subscribed to the Google Groups "ERPNext Developer Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to erpnext-developer...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/a03e750d-27da-4b13-8418-f4a626beca26%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Bobby Hartanto

unread,
Sep 29, 2014, 12:07:30 AM9/29/14
to erpnext-dev...@googlegroups.com
Hi Anand,


please check my ticket in support, i put my csv there, actually i've checked the fomat many times and the most thing that makes me confused is i have 2 csv fr 2 bom , and one csv is fine but the other isn't


Thanks

You received this message because you are subscribed to a topic in the Google Groups "ERPNext Developer Forum" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/erpnext-developer-forum/V8u7uRfbmuw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to erpnext-developer...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/erpnext-developer-forum/D826E0C0-6E63-4C7E-A83C-9CD8ED54F4B7%40iwebnotes.com.
Reply all
Reply to author
Forward
0 new messages