Is there any way to add functions that can be called by cherrypy's main loop?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Is there any way to add functions that can be called by cherrypy's main loop?

pytrade

I'm trying to debug my application with wingide using wingide's remote
debugging feature. However, this requires that some python bytecode
gets executed repeatedly so that wingide code can get some CPU time.
They gave me an example for a QT application. Can something similar be
done for cherrypy?

# Hack to burn some Python bytecode periodically so Wing's
# debugger can remain responsive while free-running
timer = QTimer()
def donothing(*args):
  for i in range(0, 100):
    x = i
timer.connect(timer, SIGNAL("timeout()", donothing)
timer.start(500, 0)

Here's a link to the complete article:

http://wingware.com/doc/howtos/non-python-mainloops

Vineet


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups-beta.google.com/group/cherrypy-users
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Is there any way to add functions that can be called by cherrypy's main loop?

pytrade

I got this response from the wingide team and it is working well for
me.

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

Would something like the following work?  I'm assuming cherrypy works
on
a request model and each request is processed in a single thread.

Initially:
  import wingdbstub
  wingdbstub.debugger.StopDebug()

For each request:
  wingdbstub.debugger.StartDebug(autoquit=0)
  process request
  wingdbstub.debugger.StopDebug()

Things will fall apart if more than one request is handled at a time,
but it should work for serialized requests


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups-beta.google.com/group/cherrypy-users
-~----------~----~----~----~------~----~------~--~---