how do i make an array global

a a at tempinbox.com
Wed Jun 28 23:58:05 EDT 2006


hi bruno georg and erik
you are right i m a newbie,
i just want to do some stuff read out some stuff from a feed and
display it in a page, so my py code, builds this list
and when it goes to cheetah it gives me an error and hence i posted
global has fixed the error but
i keep getting this again and again and i dont know why? but if i
refresh the page error goes away and the correct content comes up
please help me out


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?

Solution: Remove all .pyc files from you Zope tree and try again:
find <zopedir> -name "*.pyc" | xargs rm

How can we do this when code is running?

----------------------------------------------------------------

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:\usr\code.py", line 64, in GET
    l_code.append( len(d_list_code[i]['entries']) )
IndexError: list index out of range
Erik Max Francis wrote:
> Georg Brandl wrote:
>
> > No need for "global" here.
>
> Yes, that's true.  I was just following the original poster's lead, but
> I tend to use a `global` statement whenever I'm mutating a global in a
> local block.  That works as self-documentation and means you don't have
> to be concerned about the precise case in which it's required, reducing
> bugs when you change a block so that it would have been required if you
> hadn't included it.
>
> --
> Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
>   San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis
>    Seriousness is the only refuge of the shallow.
>     -- Oscar Wilde




More information about the Python-list mailing list