#657 Problem when debugging device servers written in Python

closed-invalid
None
PyTango
5
2014-04-24
2014-03-24
Romain Cavalier
No

Here at ONERA, we have a problem concerning the debug under Eclipse IDE.
Are you able to use breakpoints and debug mode into a device written in Python ?
Is it a PyDev problem ?

Discussion

  • Tiago Coutinho
    Tiago Coutinho
    2014-03-25

    Yes, it is a problem in PyDev

    In summary: PyDev is not able to recognize threads that are not created by python. All threads in a PyTango device server are created at the C++ Tango level. That is why you cannot debug a PyTango device server using PyDev.

    In the past, a recipe that worked was to add some code in the beginning of the main of your device server:

    _pydev_trace_func = None
    def check_pydev():
    try:
    import pydevd
    import pydevd_tracing
    debugger = pydevd.GetGlobalDebugger()
    if debugger is not None:
    global _pydev_trace_func
    _pydev_trace_func = debugger.trace_dispatch
    pydevd_tracing.SetTrace(_pydev_trace_func)
    print("PyTango in PyDev mode")
    except:
    pass

    def main()
    check_pydev()
    #....

    I have tried this with a recent eclipse and failed :(
    I have googled it and it seems it is a common problem.

    A workaround would be to use a PyDev as a remote debugger (I personally never used it)

    I recommend debugging with winpdb: http://winpdb.org/

    References:
    http://pydev.org/faq.html#PyDevFAQ-IhaveaCORBAprogramandIcannotdebugitsmethods%2CwhatcanIdo%3F

     
  • Tiago Coutinho
    Tiago Coutinho
    2014-04-24

    • status: open --> closed-invalid
    • assigned_to: Tiago Coutinho
    • Category: Archiving --> PyTango
     
  • Tiago Coutinho
    Tiago Coutinho
    2014-04-24

    Since it is a PyDev problem I will close this bug report.