[FIXED] Error in Custom Module Making

hello everyone…

am getting an error when i open a new custom module am working on (Logistics), the error is:

Traceback (innermost last):
  File "/home/frappe/frappe-bench/apps/frappe/frappe/app.py", line 57, in application
    response = frappe.handler.handle()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/handler.py", line 19, in handle
    execute_cmd(cmd)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/handler.py", line 36, in execute_cmd
    ret = frappe.call(method, **frappe.form_dict)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 805, in call
    return fn(*args, **newargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/load.py", line 64, in getdoctype
    docs = get_meta_bundle(doctype)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/load.py", line 74, in get_meta_bundle
    bundle = [frappe.desk.form.meta.get_meta(doctype)]
  File "/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/meta.py", line 22, in get_meta
    meta = FormMeta(doctype)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/meta.py", line 32, in __init__
    self.load_assets()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/meta.py", line 39, in load_assets
    self.add_code()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/meta.py", line 58, in add_code
    path = os.path.join(get_module_path(self.module), 'doctype', scrub(self.name))
  File "/home/frappe/frappe-bench/apps/frappe/frappe/modules/__init__.py", line 29, in get_module_path
    return frappe.get_module_path(module)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 614, in get_module_path
    return get_pymodule_path(local.module_app[module] + "." + module, *joins)
 KeyError: u'logistics'

my doctype configurations is:

My Mistake was i didnt check custom doctype, so the files warent made automaticaly by python, but now am still getting an error as the following:

Traceback (innermost last):
  File "/home/frappe/frappe-bench/apps/frappe/frappe/app.py", line 57, in application
    response = frappe.handler.handle()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/handler.py", line 19, in handle
    execute_cmd(cmd)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/handler.py", line 36, in execute_cmd
    ret = frappe.call(method, **frappe.form_dict)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 805, in call
    return fn(*args, **newargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/desk/reportview.py", line 147, in get_stats
    filters=["ifnull(`%s`,'')!=''" % tag], group_by=tag, as_list=True)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/desk/reportview.py", line 17, in execute
    return DatabaseQuery(doctype).execute(*args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/db_query.py", line 66, in execute
    result = self.build_and_run()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/db_query.py", line 83, in build_and_run
    return frappe.db.sql(query, as_dict=not self.as_list, debug=self.debug)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/database.py", line 147, in sql
    self._cursor.execute(query)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/cursors.py", line 205, in execute
    self.errorhandler(self, exc, value)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/MySQLdb/connections.py", line 36, in defaulterrorhandler
    raise errorclass, errorvalue
 ProgrammingError: (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '_group  order by `tabTransporter Info`.`modified` DESC' at line 2")

and if i ignore it and add a new document to the module it gives me this error:

Traceback (innermost last):
  File "/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/save.py", line 18, in savedocs
    doc.save()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 235, in save
    self.insert()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 188, in insert
    self.set_new_name()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 285, in set_new_name
    set_new_name(self)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/naming.py", line 41, in set_new_name
    frappe.throw(_("{0} is required").format(doc.meta.get_label(fieldname)))
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/meta.py", line 102, in get_label
    return self.get_field(fieldname).label
 AttributeError: 'NoneType' object has no attribute 'label'

Traceback (innermost last):
  File "/home/frappe/frappe-bench/apps/frappe/frappe/app.py", line 57, in application
    response = frappe.handler.handle()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/handler.py", line 19, in handle
    execute_cmd(cmd)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/handler.py", line 36, in execute_cmd
    ret = frappe.call(method, **frappe.form_dict)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 805, in call
    return fn(*args, **newargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/save.py", line 18, in savedocs
    doc.save()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 235, in save
    self.insert()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 188, in insert
    self.set_new_name()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 285, in set_new_name
    set_new_name(self)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/naming.py", line 41, in set_new_name
    frappe.throw(_("{0} is required").format(doc.meta.get_label(fieldname)))
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/meta.py", line 102, in get_label
    return self.get_field(fieldname).label
 AttributeError: 'NoneType' object has no attribute 'label'

Can you make sure "developer_mode":1 is added in site_config.json?

Also, restart bench and run migrate?

This doesn’t seem like a bug, but more like a technical issue.

@vjFaLk I did all already multiple times, and written the module more than 3 times, now I didn’t migrate and it’s working, but I cannot see the links until I do migrate, and when I do migrate almost all fields disappear same like its cached not written in Python…

@ramielian your fieldname transporter _group has a space! fix that and it should start working

Ya I noticed that along other mistypes
@anand I actually don’t know how to read these errors, is there any docs about it ?

@ramielian I guess you should get familiar with python (nuttawut sophapadunglert Site – Your SUPER-powered WP Engine Site) and gain experience. Python tracebacks are somewhat like complicated research papers: if you read it slowly and carefully, you can simplify what it mentions and get to the bottom of the problem.

Best,
Anand Doshi

ERPNext