Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fresh install of wiki fails: Error: No module named 'frappe.core.doctype.wiki_page' #264

Open
casesolved-co-uk opened this issue Sep 7, 2024 · 0 comments

Comments

@casesolved-co-uk
Copy link

casesolved-co-uk commented Sep 7, 2024

wiki.install.after_install tries to call page = frappe.new_doc("Wiki Page")

It appears this is done before the doctype has been loaded on a fresh app install to a site.

So this line tries to load it by default from frappe.core.doctype

https://github.com/frappe/frappe/blob/cd5f599aee14f97cc536fcedda6bfe5eb7e45c09/frappe/model/base_document.py#L79

Workaround: force a second install

Installing wiki...
An error occurred while installing wiki: Module import failed for Wiki Page, the DocType yo
u're trying to open might be deleted.<br> Error: No module named 'frappe.core.doctype.wiki_
page'
Traceback with variables (most recent call last):
  File "apps/frappe/frappe/commands/site.py", line 445, in install_app
    _install_app(app, verbose=context.verbose, force=force)
      context = {'sites': ['site'], 'force': False, 'verbose': False, 'pr
ofile': False}
      apps = ('wiki',)
      force = False
      _install_app = <function install_app at 0x74d1a97fb9c0>
      filelock = <function filelock at 0x74d1a97f94e0>
      exit_code = 0
      site = 'site'
      app = 'wiki'
      err = ImportError("Module import failed for Wiki Page, the DocType you're trying to o
pen might be deleted.<br> Error: No module named 'frappe.core.doctype.wiki_page'")
  File "apps/frappe/frappe/installer.py", line 311, in install_app
    frappe.get_attr(after_install)()
      name = 'wiki'
      verbose = False
      set_as_patched = True
      force = False
      sync_jobs = <function sync_jobs at 0x74d1a8145a80>
      sync_for = <function sync_for at 0x74d1a81468e0>
      sync_customizations = <function sync_customizations at 0x74d1a97a9940>
      sync_fixtures = <function sync_fixtures at 0x74d1a8146c00>
      app_hooks = {'after_install': ['wiki.install.after_install'], 'after_migrate': ['wiki
.wiki.doctype.wiki_page.search.rebuild_index_in_background'], 'app_color': ['grey'], 'app_d
escription': ['Simple Wiki App'], 'app_email': ['[email protected]'], 'app_icon': ['octi
con octicon-file-directory'], 'app_license': ['MIT'], 'app_name': ['wiki'], 'app_publisher'
: ['Frappe'], 'app_title': ['Wiki'], 'page_renderer': ['wiki.wiki.doctype.wiki_page.wiki_re
nderer.WikiPageRenderer'], 'scheduler_events': {'cron': {'*/15 * * * *': ['wiki.wiki.doctyp
e.wiki_page.search.rebuild_index_in_background']}}, 'website_route_rules': [{'from_route':
'/<path:wiki_page>/edit-wiki', 'to_route': '/edit'}, {'from_route': '/<path:wiki_page>/new-
wiki', 'to_route': '/new'}, {'from_route': '/<path:wiki_page>/revisions', 'to_route': '/rev
isions'}]}
      after_install = 'wiki.install.after_install'
  File "apps/wiki/wiki/install.py", line 10, in after_install
    page = frappe.new_doc("Wiki Page")
  File "apps/frappe/frappe/__init__.py", line 1190, in new_doc
    new_doc = get_new_doc(doctype, parent_doc, parentfield, as_dict=as_dict)
      doctype = 'Wiki Page'
      parent_doc = None
      parentfield = None
      as_dict = False
      kwargs = {}
      get_new_doc = <function get_new_doc at 0x74d1a45ae020>
  File "apps/frappe/frappe/model/create_new.py", line 22, in get_new_doc
    frappe.local.new_doc_templates[doctype] = make_new_doc(doctype)
      doctype = 'Wiki Page'
      parent_doc = None
      parentfield = None
      as_dict = False
  File "apps/frappe/frappe/model/create_new.py", line 35, in make_new_doc
    doc = frappe.get_doc({"doctype": doctype, "__islocal": 1, "owner": frappe.session.user,
 "docstatus": 0})
      doctype = 'Wiki Page'
  File "apps/frappe/frappe/__init__.py", line 1333, in get_doc
    doc = frappe.model.document.get_doc(*args, **kwargs)
      args = ({'doctype': 'Wiki Page', '__islocal': 1, 'owner': 'Administrator', 'docstatus
': 0},)
      kwargs = {}
      frappe = <module 'frappe' from 'apps/frappe/frappe/__init__.py'>
  File "apps/frappe/frappe/model/document.py", line 83, in get_doc
    controller = get_controller(doctype)
      args = ({'doctype': 'Wiki Page', '__islocal': 1, 'owner': 'Administrator', 'docstatus
': 0},)
      kwargs = {'doctype': 'Wiki Page', '__islocal': 1, 'owner': 'Administrator', 'docstatu
s': 0}
      doctype = 'Wiki Page'
  File "apps/frappe/frappe/model/base_document.py", line 70, in get_controller
    site_controllers[doctype] = import_controller(doctype)
      doctype = 'Wiki Page'
      site_controllers = {'DocField': <class 'frappe.core.doctype.docfield.docfield.DocFiel
d'>, 'DocPerm': <class 'frappe.core.doctype.docperm.docperm.DocPerm'>, 'Module Def': <class
 'frappe.core.doctype.module_def.module_def.ModuleDef'>, 'DocType Link': <class 'frappe.cor
e.doctype.doctype_link.doctype_link.DocTypeLink'>, 'System Settings': <class 'frappe.core.d
octype.system_settings.system_settings.SystemSettings'>, 'Notification Settings': <class 'f
rappe.desk.doctype.notification_settings.notification_settings.NotificationSettings'>, 'Def
aultValue': <class 'frappe.core.doctype.defaultvalue.defaultvalue.DefaultValue'>, 'Customiz
e Form': <class 'frappe.custom.doctype.customize_form.customize_form.CustomizeForm'>, 'DocT
ype Action': <class 'frappe.core.doctype.doctype_action.doctype_action.DocTypeAction'>, 'Do
cType State': <class 'frappe.core.doctype.doctype_state.doctype_state.DocTypeState'>, 'Cust
omize Form Field': <class 'frappe.custom.doctype.customize_form_field.customize_form_field.
CustomizeFormField'>, 'P...
  File "apps/frappe/frappe/model/base_document.py", line 95, in import_controller
    module = load_doctype_module(doctype, module_name)
      doctype = 'Wiki Page'
      Document = <class 'frappe.model.document.Document'>
      NestedSet = <class 'frappe.utils.nestedset.NestedSet'>
      module_name = 'Core'
      doctype_info = None
      module_path = None
      class_overrides = {'User': ['press.overrides.CustomUser']}
  File "apps/frappe/frappe/modules/utils.py", line 258, in load_doctype_module
    raise ImportError(msg) from e
      doctype = 'Wiki Page'
      module = 'Core'
      prefix = ''
      suffix = ''
      app = 'frappe'
      key = ********
      module_name = 'frappe.core.doctype.wiki_page.wiki_page'
      msg = "Module import failed for Wiki Page, the DocType you're trying to open might be
 deleted.<br> Error: No module named 'frappe.core.doctype.wiki_page'"
builtins.ImportError: Module import failed for Wiki Page, the DocType you're trying to open
 might be deleted.<br> Error: No module named 'frappe.core.doctype.wiki_page'

Related: #203

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant