4

I'm trying to debug python code executed from Robot. As was mentioned here by Bryan Oakley, there is possibility to debug it using:
import sys, pdb; pdb.Pdb(stdout=sys.__stdout__).set_trace()
This is a good solution and it helps a lot. Also there is a great debugger with text based graphic which is even more useful and easier to use that's called PUDB. I tried to make PUDB work in a similar way as Bryan mentioned in his answer, but I didn't succeed.
If someone managed to make it work, please share your solution.
Thank you.

catoleg
  • 43
  • 1
  • 4
  • Please show what you tried, and what error you got if you got an error. – Bryan Oakley Jan 18 '18 at 20:11
  • I'm assuming that you're aware of Python debugging functionality in Eclipse, PyCharm etc and prefer pudb? If not, then most IDE have that ability and the RED Eclipse pluging allows for debugging in Robot Context and Python context simultainiously. – A. Kootstra Jan 19 '18 at 07:10
  • here is a link to docs: http://nokia.github.io/RED/help/user_guide/launching/debug/robot_python_debug.html , in example pydevd debugger is used. You can use any debbuger if you properly start python+debugger+robot together,if breakpoint will be activated, user action needs to be done either from console, or as in example, from external Python IDE which listens to debbuger events. – jozefow Jan 21 '18 at 18:36
  • example of command line taken from runPyDevDebug.py linked in help: python -m --file Hope that helps. – jozefow Jan 22 '18 at 08:56

1 Answers1

0

The equivalent for pudb appears to be to instantiate Debugger from pudb.debugger. For example:

import pudb.debugger
import sys

def example_keyword():
    ...
    pudb.debugger.Debugger(stdout=sys.__stdout__).set_trace()
    ...
Bryan Oakley
  • 370,779
  • 53
  • 539
  • 685