[mod_python] IOError: [Errno 2] No such file or directory

Julien Pecqueur jpec at julienpecqueur.com
Sun Feb 7 08:01:23 EST 2010


Hi,

I got an error when trying to access to files which are located in a sub-directory.

>  File "/var/www/dev/pygitweb/PyGitWeb.py", line 88, in read_template
>    template = open(self.template_path, 'r')
> 
> IOError: [Errno 2] No such file or directory: 'templates/template.xhtml'


The template.xhtml file exist in the sub-directory templates :

> Index of /dev/pygitweb/templates
> 
>       Name			Last modified		Size	Description
>       Parent Directory	-
>       style.css		06-Feb-2010 21:20	 0
>       template.xhtml		06-Feb-2010 21:20	 588

When i execute the python scrit via the shell, it just works fine. I try with lighttpd + cgi + python and it works too.

I tryed to replace the file path by full path /var/http/dev/pygitweb/templates/template.xhtml but i got ht same error.

Any ideas ?





Here the full error message :

MOD_PYTHON ERROR

ProcessId:      3185
Interpreter:    'server.julienpecqueur.com'

ServerName:     'server.julienpecqueur.com'
DocumentRoot:   '/var/www/'

URI:            '/dev/pygitweb/PyGitWeb.py'
Location:       None
Directory:      '/var/www/dev/pygitweb/'
Filename:       '/var/www/dev/pygitweb/PyGitWeb.py'
PathInfo:       ''

Phase:          'PythonHandler'
Handler:        'mod_python.publisher'

Traceback (most recent call last):

  File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 1537, in HandlerDispatch
    default=default_handler, arg=req, silent=hlist.silent)

  File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 1229, in _process_target
    result = _execute_target(config, req, object, arg)

  File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 1128, in _execute_target
    result = object(arg)

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

  File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 1059, in __getitem__
    return import_module(req.filename)

  File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 296, in import_module
    log, import_path)

  File "/usr/lib/python2.5/site-packages/mod_python/importer.py", line 680, in import_module
    execfile(file, module.__dict__)

  File "/var/www/dev/pygitweb/PyGitWeb.py", line 153, in <module>
    Result = Page.build()

  File "/var/www/dev/pygitweb/PyGitWeb.py", line 95, in build
    self.read_template()

  File "/var/www/dev/pygitweb/PyGitWeb.py", line 88, in read_template
    template = open(self.template_path, 'r')

IOError: [Errno 2] No such file or directory: 'templates/template.xhtml'


MODULE CACHE DETAILS

Accessed:       Sun Feb  7 13:40:16 2010
Generation:     0

_mp_a38b6d9b42b21e0116cc275fffcfc04b {
  FileName:     '/var/www/dev/pygitweb/PyGitWeb.py'
  Instance:     1 [IMPORT]
  Generation:   0 [ERROR]
  Modified:     Sun Feb  7 12:36:47 2010
}



-- 
Julien Pecqueur (JPEC)

Site:  	http://julienpecqueur.com
Email: 	jpec at julienpecqueur.com
PGP:	B1AA2389 (GNUPG)
IRC: 	jpec (irc.freenode.net)

Powered by Archlinux - Keep it simple stupid !
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: not available
Url : http://mm_cfg_has_not_been_edited_to_set_host_domains/pipermail/mod_python/attachments/20100207/b12d3cba/attachment.bin


More information about the Mod_python mailing list