How to actually debug gradio code?

#14
by darknoon - opened

I think the messaging around "debugging" in dev mode is a bit unclear:

  • Am I supposed to be able to attach a debugger to the running space? I don't see a clear way to do this, tried looking for a pid in top but that seems wrong
  • Alternately, I could launch the space from VSCode under a debugger with "Debug python file," but then I've had issues with ZeroGPU / @spaces.GPU(…) (ie I get a generic error iirc an "infrastructure error")
  • Or is debugging a general concept, and doesn't mean you can actually use a debugger w/ a HF space?

For full context, maybeI have a conceptual issue around gradio chat errors as well, b/c I can't see how to to get the error, so I was hoping w/ dev mode I would be able to see it logged to the console or hit it in a debugger.

Screenshot 2024-07-11 at 5.10.14 PM.png

edit: I figured out how to get logs, which I think is a bit unintuitive
Screenshot 2024-07-11 at 5.16.32 PM.png

Dev Mode Explorers org

Hi @darknoon
Sorry for the delay answering, have you figured out how to attach to the Gradio app process?

Hi, I still think it's a bit confusing.
It seems like you do not have control over the actual running of the process (just the fs), so you can't connect a debugger—is this the intent?

Sign up or log in to comment