python - Error importing middleware cms.middleware.page: "No module named middleware.page" -
im unable import module though path appears correct.
>>> import cms.middleware.page traceback (most recent call last): file "<console>", line 1, in <module> importerror: no module named middleware.page
heres shows path ok
>>> x in sys.path: ... if x == "/usr/local/lib/python2.7/site-packages": ... print x ... /usr/local/lib/python2.7/site-packages
heres module
[root@monty codecrab]# ls -l /usr/local/lib/python2.7/site-packages/cms/middleware/page.py -rw-r--r-- 1 root root 1304 apr 17 19:49 /usr/local/lib/python2.7/site-packages/cms/middleware/page.py
here files
[root@monty cms]# pwd /usr/local/lib/python2.7/site-packages/cms [root@monty cms]# ls -l __init__.py middleware/__init__.py middleware/page.py -rw-r--r-- 1 root root 47 apr 17 19:49 __init__.py -rw-r--r-- 1 root root 0 apr 17 19:49 middleware/__init__.py -rw-r--r-- 1 root root 1304 apr 17 19:49 middleware/page.py
any ideas ?
this due incorrect installation of package.
to able import cms.middleware.page
, cms
directory must on python path, both cms
, middleware
directories containing __init__.py
file treated python package.
the following files/directories must exist:
/usr/local/lib/python2.7/site-packages/cms /usr/local/lib/python2.7/site-packages/cms/__init__.py /usr/local/lib/python2.7/site-packages/cms/middleware /usr/local/lib/python2.7/site-packages/cms/middleware/__init__.py /usr/local/lib/python2.7/site-packages/cms/middleware/page.py
Comments
Post a Comment