How to fix "No module error"

bench new-app timesheetMod
bench --site site.com install-app timesheetMod
bench migrate

i am using above command

ModuleNotFoundError

ModuleNotFoundError: No module named ‘timesheetmod’

Traceback (most recent call last)

  • File “/home/pkolhetkar/frappe-bench/apps/frappe/frappe/app.py”, line 99, in application

init_request(request)

  • File “/home/pkolhetkar/frappe-bench/apps/frappe/frappe/app.py”, line 172, in init_request

frappe.init(site=site, sites_path=_sites_path, force=True)

  • File “/home/pkolhetkar/frappe-bench/apps/frappe/frappe/init.py”, line 313, in init

setup_module_map(include_all_apps=not (frappe.request or frappe.job or frappe.flags.in_migrate))

  • File “/home/pkolhetkar/frappe-bench/apps/frappe/frappe/init.py”, line 1692, in setup_module_map

for module in get_module_list(app):

  • File “/home/pkolhetkar/frappe-bench/apps/frappe/frappe/init.py”, line 1540, in get_module_list

return get_file_items(get_app_path(app_name, “modules.txt”))

  • File “/home/pkolhetkar/frappe-bench/apps/frappe/frappe/init.py”, line 1505, in get_app_path

return get_pymodule_path(app_name, *joins)

  • File “/home/pkolhetkar/frappe-bench/apps/frappe/frappe/init.py”, line 1535, in get_pymodule_path

return abspath(join(dirname(get_module(scrub(modulename)).file or “”), *joins))

  • File “/home/pkolhetkar/frappe-bench/apps/frappe/frappe/init.py”, line 1476, in get_module

return importlib.import_module(modulename)

  • File “/usr/lib/python3.10/importlib/init.py”, line 126, in import_module

return _bootstrap._gcd_import(name[level:], package, level)

  • File “”, line 1050, in _gcd_import

  • File “”, line 1027, in _find_and_load

  • File “”, line 1004, in _find_and_load_unlocked

  • During handling of the above exception, another exception occurred:

  • File “/home/pkolhetkar/frappe-bench/apps/frappe/frappe/website/serve.py”, line 19, in get_response

endpoint, renderer_instance = path_resolver.resolve()

  • File “/home/pkolhetkar/frappe-bench/apps/frappe/frappe/website/path_resolver.py”, line 68, in resolve

renderer_instance = renderer(endpoint, self.http_status_code)

  • File “/home/pkolhetkar/frappe-bench/apps/frappe/frappe/website/page_renderers/static_page.py”, line 30, in __init__

self.set_file_path()

  • File “/home/pkolhetkar/frappe-bench/apps/frappe/frappe/website/page_renderers/static_page.py”, line 37, in set_file_path

file_path = frappe.get_app_path(app, “www”) + “/” + self.path

  • File “/home/pkolhetkar/frappe-bench/apps/frappe/frappe/init.py”, line 1505, in get_app_path

return get_pymodule_path(app_name, *joins)

  • File “/home/pkolhetkar/frappe-bench/apps/frappe/frappe/init.py”, line 1535, in get_pymodule_path

return abspath(join(dirname(get_module(scrub(modulename)).file or “”), *joins))

  • File “/home/pkolhetkar/frappe-bench/apps/frappe/frappe/init.py”, line 1476, in get_module

return importlib.import_module(modulename)

  • File “/usr/lib/python3.10/importlib/init.py”, line 126, in import_module

return _bootstrap._gcd_import(name[level:], package, level)

  • File “”, line 1050, in _gcd_import

  • File “”, line 1027, in _find_and_load

  • File “”, line 1004, in _find_and_load_unlocked

  • During handling of the above exception, another exception occurred:

  • File “/home/pkolhetkar/frappe-bench/apps/frappe/frappe/middlewares.py”, line 16, in __call__

return super().call(environ, start_response)

  • File “/home/pkolhetkar/frappe-bench/env/lib/python3.10/site-packages/werkzeug/middleware/shared_data.py”, line 249, in __call__

return self.app(environ, start_response)

  • File “/home/pkolhetkar/frappe-bench/env/lib/python3.10/site-packages/werkzeug/middleware/shared_data.py”, line 249, in __call__

return self.app(environ, start_response)

  • File “/home/pkolhetkar/frappe-bench/apps/frappe/frappe/app.py”, line 79, in application

app(environ, start_response),

  • File “/home/pkolhetkar/frappe-bench/env/lib/python3.10/site-packages/werkzeug/wrappers/request.py”, line 190, in application

resp = f(*args[:-2] + (request,))

  • File “/home/pkolhetkar/frappe-bench/apps/frappe/frappe/app.py”, line 132, in application

response = handle_exception(e)

  • File “/home/pkolhetkar/frappe-bench/apps/frappe/frappe/app.py”, line 395, in handle_exception

response = get_response(“message”, http_status_code=http_status_code)

  • File “/home/pkolhetkar/frappe-bench/apps/frappe/frappe/website/serve.py”, line 28, in get_response

response = ErrorPage(exception=e).render()

  • File “/home/pkolhetkar/frappe-bench/apps/frappe/frappe/website/page_renderers/error_page.py”, line 7, in __init__

super().init(path=path, http_status_code=http_status_code)

  • File “/home/pkolhetkar/frappe-bench/apps/frappe/frappe/website/page_renderers/template_page.py”, line 45, in __init__

self.set_template_path()

  • File “/home/pkolhetkar/frappe-bench/apps/frappe/frappe/website/page_renderers/template_page.py”, line 54, in set_template_path

app_path = frappe.get_app_path(app)

  • File “/home/pkolhetkar/frappe-bench/apps/frappe/frappe/init.py”, line 1505, in get_app_path

return get_pymodule_path(app_name, *joins)

  • File “/home/pkolhetkar/frappe-bench/apps/frappe/frappe/init.py”, line 1535, in get_pymodule_path

return abspath(join(dirname(get_module(scrub(modulename)).file or “”), *joins))

  • File “/home/pkolhetkar/frappe-bench/apps/frappe/frappe/init.py”, line 1476, in get_module

return importlib.import_module(modulename)

  • File “/usr/lib/python3.10/importlib/init.py”, line 126, in import_module

return _bootstrap._gcd_import(name[level:], package, level)

  • File “”, line 1050, in _gcd_import

  • File “”, line 1027, in _find_and_load

  • File “”, line 1004, in _find_and_load_unlocked

ModuleNotFoundError: No module named ‘timesheetmod’

The debugger caught an exception in your WSGI application. You can now look at the traceback which led to the error.

To switch between the interactive traceback and the plaintext one, you can click on the “Traceback” headline. From the text traceback you can also create a paste of it. For code execution mouse-over the frame you want to debug and click on the console icon on the right side.

You can execute arbitrary Python code in the stack frames and there are some extra helpers available for introspection:

  • dump() shows all variables in the frame
  • dump(obj) dumps all that’s known about the object

I think the issue may be in the custom app, so please check it yourself. If not, stop the bench and restart it, and also migrate the site and check it.

@Prashanth_Kolhetkar try this bench --site site.com install-app timesheetmod

1 Like

@Jeel Thank you its working