psyco+webpy

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • a

    #1

    psyco+webpy

    hi i tried psyco+webpy

    here is the error that i got
    please let me know if any of you has success run psyco+webpy
    thanks

    import web, psyco
    urls = (
    '/', 'view',
    '/add','add'
    )
    psyco.full()
    psyco.log()
    psyco.profile()

    Launching server: http://0.0.0.0:8080/
    Traceback (most recent call last):
    File "C:\Python24\li b\site-packages\web.py ", line 2054, in
    run_wsgi_app
    result = self.server.app (env, self.wsgi_start _response)
    File "C:\Python24\li b\site-packages\web.py ", line 1894, in wsgifunc
    result = func()
    File "C:\Python24\li b\site-packages\web.py ", line 1872, in <lambda>
    func = lambda: handle(getattr( mod, name), mod)
    File "C:\Python24\li b\site-packages\web.py ", line 1051, in handle
    return tocall(*([urllib.unquote( x) for x in args] + fna))
    File "C:\mark\web1\c odepsyco.py", line 27, in GET
    web.render('vie w.html')
    File "C:\Python24\li b\site-packages\web.py ", line 1707, in render
    terms.update(sy s._getframe(1). f_locals)
    File "C:\Python24\Li b\site-packages\psyco\ support.py", line 129, in
    __getattr_
    _
    raise AttributeError, ("local variables of functions run by Psyco "
    AttributeError: local variables of functions run by Psyco cannot be
    accessed in
    any way, sorry
    Traceback (most recent call last):
    File "C:\Python24\li b\SocketServer. py", line 463, in
    process_request _thread
    self.finish_req uest(request, client_address)
    File "C:\Python24\li b\SocketServer. py", line 254, in finish_request
    self.RequestHan dlerClass(reque st, client_address, self)
    File "C:\Python24\li b\SocketServer. py", line 521, in __init__
    self.handle()
    File "C:\Python24\li b\BaseHTTPServe r.py", line 316, in handle
    self.handle_one _request()
    File "C:\Python24\li b\BaseHTTPServe r.py", line 310, in
    handle_one_requ est
    method()
    File "C:\Python24\li b\site-packages\web.py ", line 2090, in do_GET
    self.run_wsgi_a pp()
    File "C:\Python24\li b\site-packages\web.py ", line 2072, in
    run_wsgi_app
    internalerror()
    File "C:\Python24\li b\site-packages\web.py ", line 1601, in debugerror
    out = str(djangoerror ())
    File "C:\Python24\li b\site-packages\web.py ", line 1587, in
    djangoerror
    return render(DJANGO_5 00_PAGE, asTemplate=True , isString=True)
    File "C:\Python24\li b\site-packages\web.py ", line 1707, in render
    terms.update(sy s._getframe(1). f_locals)
    File "C:\Python24\Li b\site-packages\psyco\ support.py", line 129, in
    __getattr_
    _
    raise AttributeError, ("local variables of functions run by Psyco "
    AttributeError: local variables of functions run by Psyco cannot be
    accessed in
    any way, sorry

  • Amaury Forgeot d'Arc

    #2
    Re: psyco+webpy

    a a écrit :[color=blue]
    > hi i tried psyco+webpy
    >
    > here is the error that i got
    > please let me know if any of you has success run psyco+webpy
    > thanks
    >
    > import web, psyco
    > urls = (
    > '/', 'view',
    > '/add','add'
    > )
    > psyco.full()
    > psyco.log()
    > psyco.profile()
    >
    > Launching server: http://0.0.0.0:8080/
    > Traceback (most recent call last):
    > File "C:\Python24\li b\site-packages\web.py ", line 2054, in
    > run_wsgi_app
    > result = self.server.app (env, self.wsgi_start _response)
    > File "C:\Python24\li b\site-packages\web.py ", line 1894, in wsgifunc
    > result = func()
    > File "C:\Python24\li b\site-packages\web.py ", line 1872, in <lambda>
    > func = lambda: handle(getattr( mod, name), mod)
    > File "C:\Python24\li b\site-packages\web.py ", line 1051, in handle
    > return tocall(*([urllib.unquote( x) for x in args] + fna))
    > File "C:\mark\web1\c odepsyco.py", line 27, in GET
    > web.render('vie w.html')
    > File "C:\Python24\li b\site-packages\web.py ", line 1707, in render
    > terms.update(sy s._getframe(1). f_locals)
    > File "C:\Python24\Li b\site-packages\psyco\ support.py", line 129, in
    > __getattr__[/color]

    Functions optimized by Psyco have limitations concerning access of their
    local variables, as stated there:
    http://psyco.sourcefor ge.net/psycoguide/bugs.html
    As a workaround, you should prevent psyco from optimizing the functions
    calling render().

    psyco.cannotcom pile(web.django error)
    psyco.cannotcom pile(??.GET)

    P.S. I just had a look at the web.py code and it seems that there are
    several uses of _getframe(x).f_ locals. I find this trick not very
    pythonic (a function's docstring even says:"""Guido van Rossum doesn't
    want you to use this function.""") and anyway psyco will not appreciate it.

    --
    Amaury

    Comment

    • a

      #3
      Re: psyco+webpy

      > psyco.cannotcom pile(??.GET) this gives an error message
      invalid syntax
      Amaury Forgeot d'Arc wrote:[color=blue]
      > a a écrit :[color=green]
      > > hi i tried psyco+webpy
      > >
      > > here is the error that i got
      > > please let me know if any of you has success run psyco+webpy
      > > thanks
      > >
      > > import web, psyco
      > > urls = (
      > > '/', 'view',
      > > '/add','add'
      > > )
      > > psyco.full()
      > > psyco.log()
      > > psyco.profile()
      > >
      > > Launching server: http://0.0.0.0:8080/
      > > Traceback (most recent call last):
      > > File "C:\Python24\li b\site-packages\web.py ", line 2054, in
      > > run_wsgi_app
      > > result = self.server.app (env, self.wsgi_start _response)
      > > File "C:\Python24\li b\site-packages\web.py ", line 1894, in wsgifunc
      > > result = func()
      > > File "C:\Python24\li b\site-packages\web.py ", line 1872, in <lambda>
      > > func = lambda: handle(getattr( mod, name), mod)
      > > File "C:\Python24\li b\site-packages\web.py ", line 1051, in handle
      > > return tocall(*([urllib.unquote( x) for x in args] + fna))
      > > File "C:\mark\web1\c odepsyco.py", line 27, in GET
      > > web.render('vie w.html')
      > > File "C:\Python24\li b\site-packages\web.py ", line 1707, in render
      > > terms.update(sy s._getframe(1). f_locals)
      > > File "C:\Python24\Li b\site-packages\psyco\ support.py", line 129, in
      > > __getattr__[/color]
      >
      > Functions optimized by Psyco have limitations concerning access of their
      > local variables, as stated there:
      > http://psyco.sourcefor ge.net/psycoguide/bugs.html
      > As a workaround, you should prevent psyco from optimizing the functions
      > calling render().
      >
      > psyco.cannotcom pile(web.django error)
      > psyco.cannotcom pile(??.GET)
      >
      > P.S. I just had a look at the web.py code and it seems that there are
      > several uses of _getframe(x).f_ locals. I find this trick not very
      > pythonic (a function's docstring even says:"""Guido van Rossum doesn't
      > want you to use this function.""") and anyway psyco will not appreciate it.
      >
      > --
      > Amaury[/color]

      Comment

      • Amaury Forgeot d'Arc

        #4
        Re: psyco+webpy

        a a écrit :[color=blue][color=green]
        >> psyco.cannotcom pile(??.GET) this gives an error message[/color]
        > invalid syntax[/color]

        Oh, I assumed that you would replace the ?? by the correct expression.
        You need to specify the GET function of the class you've written in the
        file "codepsyco. py" (I don't know the class name. It does not appear in
        the error traceback)
        Depending on your architecture, this may be written this way:

        import codepsyco
        psyco.cannotcom pile(codepsyco. YourClassHere.G ET)



        --
        Amaury

        Comment

        Working...