IOError: [Errno 2] No such file or directory

Julien Pecqueur <[email protected]> Sun, 7 Feb 2010 14:01:23 +0100
Newsgroups gmane.comp.python.mod_python
Message-ID <[email protected]>
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: 	[email protected]
PGP:	B1AA2389 (GNUPG)
IRC: 	jpec (irc.freenode.net)

Powered by Archlinux - Keep it simple stupid !

_______________________________________________
Mod_python mailing list
[email protected]
http://mailman.modpython.org/mailman/listinfo/mod_python
signature.asc (application/pgp-signature, 198 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)

iEYEARECAAYFAktuuaMACgkQjhahKLGqI4nZpwCfU66822d+obf+lcU9/ocMtYp+
gEoAoKDf1x2rIk1pBq1nJ4GBzqMk+SAI
=TZo/
-----END PGP SIGNATURE-----