ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> python-list
python-list
Can't Find Module
by Victor Subervi other posts by this author
Nov 7 2009 9:02AM messages near this date
Re: exception due to NoneType | Re: Can't Find Module
Hi;
I'm getting this error:

Mod_python error: "PythonHandler mod_python.publisher"

Traceback (most recent call last):

  File "/usr/lib64/python2.4/site-packages/mod_python/apache.py", line 299,
in HandlerDispatch
    result = object(req)

  File "/usr/lib64/python2.4/site-packages/mod_python/publisher.py", line
204, in handler
    module = page_cache[req]

  File "/usr/lib64/python2.4/site-packages/mod_python/cache.py", line 82, in
__getitem__
    return self._checkitem(name)[2]

  File "/usr/lib64/python2.4/site-packages/mod_python/cache.py", line 124,
in _checkitem
    value = self.build(key, name, opened, entry)

  File "/usr/lib64/python2.4/site-packages/mod_python/publisher.py", line
77, in build
    return ModuleCache.build(self, key, req, opened, entry)

  File "/usr/lib64/python2.4/site-packages/mod_python/cache.py", line 371,
in build
    exec opened in module.__dict__

  File "/var/www/html/angrynates.com/global_solutions/index.py", line 8, in
?
    from template import template

ImportError: No module named template


Here's the code:

#!/usr/bin/python

import string
import cgitb; cgitb.enable()
import cgi
import sys,os
sys.path.append(os.getcwd())
from template import template

ourFile = string.split(__file__, "/")
page = ourFile[len(ourFile) - 1][:-3]

form = cgi.FieldStorage()
w = form.getfirst('w', '1024')

print page

template(page, w)


I can import this just fine from the python command prompt. So, what gives?
TIA,
Victor
Thread:
Victor Subervi
Rhodri James

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved