Error while installing erpnext in site : Development Mode

Hi,

I keep getting Indentation error white installing erpnext on site. Anyone from the team please help.

    bench --site locus install-app erpnext

Error:

Updating erpnext                    : [======================                  ]Traceback (most recent call last):
  File "/usr/local/Cellar/python/2.7.12/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 174, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/local/Cellar/python/2.7.12/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/Users/ravi/Documents/nestaway/frappe-bench/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 79, in <module>
    main()
  File "/Users/ravi/Documents/nestaway/frappe-bench/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 16, in main
    click.Group(commands=commands)(prog_name='bench')
  File "/Users/ravi/Documents/nestaway/frappe-bench/frappe-bench/env/lib/python2.7/site-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/Users/ravi/Documents/nestaway/frappe-bench/frappe-bench/env/lib/python2.7/site-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/Users/ravi/Documents/nestaway/frappe-bench/frappe-bench/env/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/ravi/Documents/nestaway/frappe-bench/frappe-bench/env/lib/python2.7/site-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Users/ravi/Documents/nestaway/frappe-bench/frappe-bench/env/lib/python2.7/site-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Users/ravi/Documents/nestaway/frappe-bench/frappe-bench/env/lib/python2.7/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/Users/ravi/Documents/nestaway/frappe-bench/frappe-bench/env/lib/python2.7/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), *args, **kwargs)
  File "/Users/ravi/Documents/nestaway/frappe-bench/frappe-bench/apps/frappe/frappe/commands/__init__.py", line 24, in _func
    ret = f(frappe._dict(ctx.obj), *args, **kwargs)
  File "/Users/ravi/Documents/nestaway/frappe-bench/frappe-bench/apps/frappe/frappe/commands/site.py", line 150, in install_app
    _install_app(app, verbose=context.verbose)
  File "/Users/ravi/Documents/nestaway/frappe-bench/frappe-bench/apps/frappe/frappe/installer.py", line 131, in install_app
    sync_for(name, force=True, sync_everything=True, verbose=verbose)
  File "/Users/ravi/Documents/nestaway/frappe-bench/frappe-bench/apps/frappe/frappe/model/sync.py", line 43, in sync_for
    import_file_by_path(doc_path, force=force)
  File "/Users/ravi/Documents/nestaway/frappe-bench/frappe-bench/apps/frappe/frappe/modules/import_file.py", line 54, in import_file_by_path
    import_doc(doc, force=force, data_import=data_import, pre_process=pre_process)
  File "/Users/ravi/Documents/nestaway/frappe-bench/frappe-bench/apps/frappe/frappe/modules/import_file.py", line 122, in import_doc
    doc.insert()
  File "/Users/ravi/Documents/nestaway/frappe-bench/frappe-bench/apps/frappe/frappe/model/document.py", line 231, in insert
    self.run_post_save_methods()
  File "/Users/ravi/Documents/nestaway/frappe-bench/frappe-bench/apps/frappe/frappe/model/document.py", line 728, in run_post_save_methods
    self.run_method("on_update")
  File "/Users/ravi/Documents/nestaway/frappe-bench/frappe-bench/apps/frappe/frappe/model/document.py", line 661, in run_method
    return Document.hook(fn)(self, *args, **kwargs)
  File "/Users/ravi/Documents/nestaway/frappe-bench/frappe-bench/apps/frappe/frappe/model/document.py", line 839, in composer
    return composed(self, method, *args, **kwargs)
  File "/Users/ravi/Documents/nestaway/frappe-bench/frappe-bench/apps/frappe/frappe/model/document.py", line 822, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "/Users/ravi/Documents/nestaway/frappe-bench/frappe-bench/apps/frappe/frappe/model/document.py", line 655, in <lambda>
    fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
  File "/Users/ravi/Documents/nestaway/frappe-bench/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py", line 148, in on_update
    self.run_module_method("on_doctype_update")
  File "/Users/ravi/Documents/nestaway/frappe-bench/frappe-bench/apps/frappe/frappe/core/doctype/doctype/doctype.py", line 157, in run_module_method
    module = load_doctype_module(self.name, self.module)
  File "/Users/ravi/Documents/nestaway/frappe-bench/frappe-bench/apps/frappe/frappe/modules/__init__.py", line 64, in load_doctype_module
    doctype_python_modules[key] = frappe.get_module(get_module_name(doctype, module, prefix, suffix))
  File "/Users/ravi/Documents/nestaway/frappe-bench/frappe-bench/apps/frappe/frappe/__init__.py", line 644, in get_module
    return importlib.import_module(modulename)
  File "/usr/local/Cellar/python/2.7.12/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "/Users/ravi/Documents/nestaway/frappe-bench/frappe-bench/apps/erpnext/erpnext/hr/doctype/salary_slip/salary_slip.py", line 57
    if amount:
    ^
IndentationError: unexpected indent

please check the indentation error in salary_slip.py line no 57

this is the erpnext code cloned from git repo. I was hoping these errors wont be part of the code and they are cropping up because of some other reason.

@ravilakhotia,

If you did not made any changes in erpnext app then you can stash the changes.

go to ~\frappe-bench\apps\erpnext
and use the git status

check the status if there are unwanted changes then either use git checkout or git stash to discard the changes

which branch code I should be using?

for development use the develop branch for production use master branch

I have to make few hooks and use the erpnext in production in a weeks time. In that case I should be switching to “master” right ?

you should place your customize code in custom app otherwise, the system will break while taking the bench update

thanks for the pointer. I want to make hook for on_update, on_create of Leads doctype. Can you please tell the steps which needs to be followed ? [ I have read the hooks documentation. So steps which needs to be followed other than writing the hooks code.]

Please refer

thanks will look into the tutorials.

could not resolve the error by git checkout / git stash. Its still there. Also not able to fetch “master” code .

This issue has been fixed via https://github.com/frappe/erpnext/pull/6427.

thanks @KanchanChauhan @makarand_b for prompt response and the fix. Issue is fixed now, please close this topic.