New page error:No module named www.pagename

HI

I am getting error after creating a page in www folder.
I am using V7

Traceback (most recent call last):
File “/home/amalendu/erpnext-AMC/frappe-bench/apps/frappe/frappe/website/render.py”, line 32, in render
data = render_page_by_language(path)
File “/home/amalendu/erpnext-AMC/frappe-bench/apps/frappe/frappe/website/render.py”, line 101, in render_page_by_language
return render_page(path)
File “/home/amalendu/erpnext-AMC/frappe-bench/apps/frappe/frappe/website/render.py”, line 117, in render_page
return build(path)
File “/home/amalendu/erpnext-AMC/frappe-bench/apps/frappe/frappe/website/render.py”, line 124, in build
return build_page(path)
File “/home/amalendu/erpnext-AMC/frappe-bench/apps/frappe/frappe/website/render.py”, line 137, in build_page
context = get_context(path)
File “/home/amalendu/erpnext-AMC/frappe-bench/apps/frappe/frappe/website/context.py”, line 19, in get_context
context = build_context(context)
File “/home/amalendu/erpnext-AMC/frappe-bench/apps/frappe/frappe/website/context.py”, line 65, in build_context
module = frappe.get_module(context.controller)
File “/home/amalendu/erpnext-AMC/frappe-bench/apps/frappe/frappe/init.py”, line 643, in get_module
return importlib.import_module(modulename)
File “/usr/lib/python2.7/importlib/init.py”, line 37, in import_module
import(name)
ImportError: No module named www.dashboard

Anyone know why this error?

Share your code!

Hi @rmehta

i have dashboard.html file to show a dropdown box and a table

I have added dashboard.py, to fill the table dynamically.

The dashboard.html shows static data.
But when I added dashboard.py file in www folder, suddenly it shows the above error!

My dashboard.py file has nothing but,

from __future__ import unicode_literals
import frappe

def get_context(context):
	context.no_cache = True			
	if frappe.session.user == "Administrator":
		context.user = "Administrator"

If I remove this .py file then the page gets displayed!

Please help me somebody to resolve this issue!

I have run into a similar issue that may be the same. It relates to a folder structure.

www/example/index.html
www/example/index.py

ImportError: No module named example.index

hello @Derekbrenner

Do you have __init__.py file in the same folder?

1 Like

That was the issue. Thank you!

Thank you.