Pekka Jääskeläinen wrote:
> I don't know what I did differently, but this time the server didn't
> exit, but I got this:

Ah... it looks it's because Pylons introspects the signature to figure 
out what parameters to pass, and the signature of the decorated function 
is *args, **kw.  But then it passes all those arguments to the enclosed 
function, and that breaks it.

You'll have to add **kw to your index method.

> 
>   Error Traceback
> 
> clear this clear this
> Module paste.debug.profile:*138* in |replacement|         
> <http://localhost:5000/front#>
> |<<  <http://localhost:5000/front#>    *def* *decorator**(**func**)**:*
>             *def* *replacement**(*****args**,* *****kw**)**:*
>                 *return* DecoratedProfile*(*func*,* ****options 
> *)**(****args*,* ****kw*)*
>             *return* replacement
>         *return* decorator|| >>  <http://localhost:5000/front#>*return* 
> DecoratedProfile*(*func*,* ****options*)**(**** args*,* ****kw*)*|
> Module paste.debug.profile:*153* in |__call__|         
> <http://localhost:5000/front#>
> |<<  <http://localhost:5000/front#>        self*.* lock*.*acquire*(**)*
>             *try**:*
>                 *return* self*.*profile*(*self*.* func*,* ***args*,* 
> ****kw*)*
>             *finally**:*
>                 self*.*lock*.*release*(**)*|| >>  
> <http://localhost:5000/front#>*return* self*.*profile*(*self*.*func*,* 
> ***args*,* ****kw*)*|
> Module paste.debug.profile:*169* in |profile|         
> <http://localhost:5000/front#>
> |<<  <http://localhost:5000/front#>            start_time *=* 
> time*.*time*(**)*
>                 *try**:*
>                     result *=* prof*.*runcall*(*func*,* ***args*,* ****kw*)*
>                 *except**:*
>                     exc_info *=* sys*.*exc_info*(**)*|| >>  
> <http://localhost:5000/front#>result *=* prof*.*runcall*(*func*,* 
> ***args *,* ****kw*)*|
> Module hotshot:*76* in |runcall|         <http://localhost:5000/front#>
> *<type 'exceptions.TypeError'>: index() got an unexpected keyword 
> argument 'action'*
> 
> The profiler did print something to the console paster server was 
> started in:
> 
>   from pylons.database import session_context as ctx
>          0 function calls in 0.000 CPU seconds
> 
>    Ordered by: internal time, call count
> 
>    ncalls  tottime  percall  cumtime  percall filename:lineno(function)
>         0    0.000             0.000          profile:0(profiler)
> 
> 
>    Ordered by: internal time, call count
> 
> Function             was called by...
> profile:0(profiler)  <-
> 
> 
> Function call: index(<tron.controllers.front.FrontController object at 
> 0x8a23b2c>, action='index', start_response=
> [the response contents here]
> Wall time: 0.00 seconds
> 
> So the profiling data printed (to the console) was empty due to the 
> exception.
> 
> On 8/27/07, *Ian Bicking* <[EMAIL PROTECTED] 
> <mailto:[EMAIL PROTECTED]> > wrote:
> 
>     Exited like a segfault?  It's possible the profiler doesn't interact 
> 
> 
> No segfault. Just a clean exit(), it was, with a 0 exit code.
> 
>     well with some module you are using (something in C), or that the
>     profiler itself is acting odd.  Any segfault is a sign of a bug
>     somewhere in the Python interpreter (unlikely) or some C module (more
>     likely), or sometimes Python code which is doing something diabolical
>     (which would be a bug in the Python interpreter still, but some bug that
>     isn't often encountered).  Since paste.debug.profile doesn't have any C
>     code, I'd be most inclined to think it's a bad interaction of some C
>     module and the profiler.
> 
> 
> Hmm. it might have been be the cmemcached, it uses some C code. I'll try 
> using the
> pure Python version of the memcached client if it appears again.
> 
> Anyways, do you know how to enable the profiling middleware for all
> controllers (in the config file)?
> -- 
> --PJ
> > 


-- 
Ian Bicking : [EMAIL PROTECTED] : http://blog.ianbicking.org
             : Write code, do good : http://topp.openplans.org/careers

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

Reply via email to