Google Calendar error when installing new custom app

Hey guys,
Your help will be very much appreciated. So I have just created a new app named “bookings”

After I issue the command bench --site [sitename] install-app bookings this is the error that appears:

Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 97, 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/local/lib/python2.7/site-packages/click/core.py", line 764, in _call_
    return self.main(*args, **kwargs)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/home/frappe/frappe-bench/env/local/lib/python2.7/site-packages/click/decorators.py", line 17, in new_func
    return f(get_current_context(), args, *kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/__init__.py", line 25, in _func
    ret = f(frappe._dict(ctx.obj), args, *kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/commands/site.py", line 173, in install_app
    _install_app(app, verbose=context.verbose)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/installer.py", line 84, in install_app
    add_to_installed_apps(name)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/installer.py", line 108, in add_to_installed_apps
    post_install(rebuild_website)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/installer.py", line 169, in post_install
    init_singles()
  File "/home/frappe/frappe-bench/apps/frappe/frappe/installer.py", line 187, in init_singles
    doc = frappe.new_doc(single)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 668, in new_doc
    return get_new_doc(doctype, parent_doc, parentfield, as_dict=as_dict)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/create_new.py", line 21, in get_new_doc
    frappe.local.new_doc_templates[doctype] = make_new_doc(doctype)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/create_new.py", line 39, in make_new_doc
    "docstatus": 0
  File "/home/frappe/frappe-bench/apps/frappe/frappe/__init__.py", line 734, in get_doc
    doc = frappe.model.document.get_doc(*args, **kwargs)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 67, in get_doc
    controller = get_controller(doctype)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/model/base_document.py", line 47, in get_controller
    module = load_doctype_module(doctype, module_name)
  File "/home/frappe/frappe-bench/apps/frappe/frappe/modules/utils.py", line 206, in load_doctype_module
    raise ImportError('Module import failed for {0} ({1})'.format(doctype, module_name + ' Error: ' + str(e)))
ImportError: Module import failed for GCalendar Settings (frappe.integrations.doctype.gcalendar_settings.gcalendar_settings Error: No module named gcalendar_settings.gcalendar_settings)

Solution: delete all google doctypes from erpnext and also through bench console

@Iulian_Olaru Can you please show the commands to delete all google doctypes?

@ophl55 I will ask our developer to reply here as soon as possible.

bench console
frappe.db.sql(“”" delete from tabDocType where name =‘xxx’“”")

or bench mariadb

delete from tabDocType where name =‘xxx’;

I remember there are more than one google calendar related doctypes to be handled, see the error message. good luck.

Yes you have the doctypes which are visible in erpnext integrations section but you have extra doctypes named gcalendar that show up in bench console… take a look :slight_smile:

I had an GCalender error when installing new app and this solves my problem:

bench disable-scheduler
bench enable-scheduler
bench clear-cache
bench clear-website-cache

After that install-app command worked as expected. My problem was:

ImportError: Module import failed for GCalendar Settings (frappe.integrations.doctype.gcalendar_settings.gcalendar_settings Error: No module named ‘frappe.integrations.doctype.gcalendar_settings.gcalendar_settings’)

Sorry but just to jump in - don’t overlook that tabSingles stores for eg GSuite Settings Google Auth Problem - #3 by clarkej

I got same problem on different server after 5 months. Glad I’ve noted the solution here :slight_smile: