Pydev debugger and atexit handlers

2006-12-07
2013-03-15
  • F. Oliver Gathmann

    When running a Python process that registers a custom cleanup callback using the atexit.register facilities of the builtin library under the Pydev debugger, shutdown fails without any traceback information in the call to sys.exit(0) in line 440 of the pydevd.py module.

    The problem appears to be that the debugger seems to trace the shutdown routines; if I add a sys.settrace(None) just before the sys.exit() call in line 440, everything works fine (although that surely is anything but a proper fix...).

    I also have to make sure the atexit cleanup handlers don't print anything to sys.stdout which is not a problem when I run the same program from a shell.

    Any further insight into these issues is greatly appreciated,

    Oliver

     
    • Fabio Zadrozny

      Fabio Zadrozny - 2006-12-09

      Hi Oliver,

      I'm having some trouble duplicating your behaviour...

      I've tried it with the code below, and it seems to work for me... Also, I think that you should report that in the bug-tracker... Check http://pydev.sourceforge.net/faq.html#ref_0 for more details on the bug-reporting guidelines (so, maybe you could paste some code to help me reproduce it).

      Cheers,

      Fabio

      ---------- Code I used to test ------------

      import atexit

      def bla(*args, **kwargs):
          print args, kwargs

      class Foo(object):
         
          def __init__(self):
              atexit.register(bla)
         
      if __name__ == '__main__':
          Foo()

       

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks