Can't Find Module

View: New views
2 Messages — Rating Filter:   Alert me  

Can't Find Module

by Victor Subervi :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

--
http://mail.python.org/mailman/listinfo/python-list

Re: Can't Find Module

by Rhodri James :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Sat, 07 Nov 2009 16:59:29 -0000, Victor Subervi  
<victorsubervi@...> wrote:

> ImportError: No module named template
[snip]
>
> I can import this just fine from the python command prompt. So, what  
> gives?

Is template.py in your current directory when you run the script from the  
command line?

--
Rhodri James *-* Wildebeest Herder to the Masses
--
http://mail.python.org/mailman/listinfo/python-list