[mod_python] Publisher Handler

Erik Stephens mod_python at 24ksoftware.com
Thu Mar 11 22:35:10 EST 2004

On Thu, 11 Mar 2004, Arnaldo  Riquelme wrote:

> I have this on my Apache config
> <Directory "C:/Program Files/Apache Group/Apache2/htdocs/publisher">
>   SetHandler mod_python
>   PythonHandler mod_python.publisher
>   PythonDebug On
> </Directory>
> I also have the two files from the article hello.tmpl and pubpsp.py
> both on C:/Program Files/Apache Group/Apache2/htdocs/publisher.

> [snip]
>   File "C:\Python23\Lib\site-packages\mod_python\psp.py", line 194, in
> load_from_file
>     raise ValueError, "%s is not a file" % filename
> ValueError: hello.tmpl is not a file
> Why does it say that hello.tmpl is not a file? Can anyone point out
> what I'm missing here?

I'm not using Windows, but in my psp.py file there is:

    # if filename is not absolute, default to our guess
    # of current directory
    if not os.path.isabs(filename):
	base = os.path.split(req.filename)[0]
	self.filename = os.path.join(base, filename)

Assuming you're giving the PSP constructer a relative pathname, you
can try something like this in your method to see what this is doing
in your setup:

  raise 'DebugError', [req.filename, os.path.split(req.filename)]

Hope this doesn't sound like a cop-out, but look at the source.  It
may sound daunting at times (it does to me :), but it's worth it.
That's one nice thing about Python: you don't spend so much time
tripping over someone's style when reading their code.

Best regards,

More information about the Mod_python mailing list