how do i make an array global

a a at tempinbox.com
Thu Jun 29 19:10:17 CEST 2006


i understand index error
but there is no index error in my code that is the problem!
Marc 'BlackJack' Rintsch wrote:
> In <1151553485.378000.203760 at p79g2000cwp.googlegroups.com>, a wrote:
>
> > Traceback (most recent call last):
> >   File "C:\Python24\lib\site-packages\web.py", line 2054, in
> > run_wsgi_app
> >     result = self.server.app(env, self.wsgi_start_response)
> >   File "C:\Python24\lib\site-packages\web.py", line 1894, in wsgifunc
> >     result = func()
> >   File "C:\Python24\lib\site-packages\web.py", line 1872, in <lambda>
> >     func = lambda: handle(getattr(mod, name), mod)
> >   File "C:\Python24\lib\site-packages\web.py", line 1051, in handle
> >     return tocall(*([urllib.unquote(x) for x in args] + fna))
> >   File "c:\mark\web1\code.py", line 64, in GET
> >     l_code.append( len(d_list_code[i]['entries']) )
> > IndexError: list index out of range
> >
> > it goes off when page is refreshed
> >
> > I m getting the following error, infrequently and if I refresh the
> > page, it just displays the page properly
> > I am unable to find the problem.  How is this out of range and what
> > does the error message mean?
>
> The error message means that you try to access a list item that does not
> exist::
>
>  In [1]: a = [1, 2, 3]
>
>  In [2]: a[0]
>  Out[2]: 1
>
>  In [3]: a[1]
>  Out[3]: 2
>
>  In [4]: a[2]
>  Out[4]: 3
>
>  In [5]: a[3]
>  -------------------------------------------------------------------------
>  exceptions.IndexError                    Traceback (most recent call last)
>
>  /home/marc/<ipython console>
>
>  IndexError: list index out of range
>
> So from the traceback it seems that `i` has a value that's not between 0
> and ``len(d_list_code)``.
> 
> Ciao,
> 	Marc 'BlackJack' Rintsch




More information about the Python-list mailing list