On Sep 11, 8:27 pm, Arnold Chen <[EMAIL PROTECTED]> wrote:
> Dear all,
>
> I am experiencing some situation that is very strange. the development
> site ishttp://alberta.design97.com
>
> This site is django-powered, it is up sometimes, on some computers,
> you can visit this site for a preview, if you get an error, try reload
> the page, usually the page will show within 5-10 times reload.
>
> The error message that i SOMETIMES got is:
>
> MOD_PYTHON ERROR
>
> ProcessId:      15673
> Interpreter:    'alberta.design97.com'
>
> ServerName:     'alberta.design97.com'
> DocumentRoot:   '/var/www/vhosts/design97.com/subdomains/alberta/
> httpdocs'
>
> URI:            '/'
> Location:       '/'
> Directory:      None
> Filename:       '/var/www/vhosts/design97.com/subdomains/alberta/
> httpdocs/'
> PathInfo:       ''
>
> Phase:          'PythonHandler'
> Handler:        'django.core.handlers.modpython'
>
> Traceback (most recent call last):
>
>   File "/usr/lib/python2.3/site-packages/mod_python/importer.py", line
> 1537, in HandlerDispatch
>     default=default_handler, arg=req, silent=hlist.silent)
>
>   File "/usr/lib/python2.3/site-packages/mod_python/importer.py", line
> 1229, in _process_target
>     result = _execute_target(config, req, object, arg)
>
>   File "/usr/lib/python2.3/site-packages/mod_python/importer.py", line
> 1128, in _execute_target
>     result = object(arg)
>
>   File "/usr/lib/python2.3/site-packages/django/core/handlers/
> modpython.py", line 177, in handler
>     return ModPythonHandler()(req)
>
>   File "/usr/lib/python2.3/site-packages/django/core/handlers/
> modpython.py", line 150, in __call__
>     response = self.get_response(request)
>
>   File "/usr/lib/python2.3/site-packages/django/core/handlers/
> base.py", line 111, in get_response
>     return debug.technical_500_response(request, *sys.exc_info())
>
>   File "/usr/lib/python2.3/site-packages/django/views/debug.py", line
> 103, in technical_500_response
>     pre_context_lineno, pre_context, context_line, post_context =
> _get_lines_from_file(filename, lineno, 7, loader, module_name)
>
>   File "/usr/lib/python2.3/site-packages/django/views/debug.py", line
> 195, in _get_lines_from_file
>     context_line = source[lineno].strip('\n')
>
> IndexError: list index out of range

This would appear possibly to be a secondary problem to your real
problem.

Ie., some exception is occurring in your code which is triggering a
debug page and display of that debug page is failing.

The intent of the debug page is to display the source code context
from your code file. It does this by opening up the code file and
reading it. If however the code file has been changed since it was
loaded, it may contain a different number of lines to what the running
code thinks it has. If the error line is greater than how many lines
now exist in the code file, then it would be trying to access a line
that doesn't exist and would fail.

This mismatch may also occur if for some reason the .py file was
changed, but the .pyc/.pyo file next to it is still newer but for a
different lot of code. Thus remove .pyc/.pyo files and see if that
makes a difference.

The only other alternative is that somehow incorrect filename or line
number is being passed to _get_lines_from_file(). You would have to
instrument the Django code with some debugging statements to see what
is being passed to work out whether that is the case.

BTW, what version of Django are you using? The number of arguments to
_get_lines_from_file() differs to what is used in 0.95/0.96. Are you
using an older version, or newer version from subversion?

Graham


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to