Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • 3
    Don’t use a bare except:; it catches too much. Commented Mar 23, 2019 at 19:11
  • 1
    Also the current syntax is invalid. Edit it please to lowercase try, except, pass. Commented Mar 23, 2019 at 19:15
  • Try using except TypeError: instead. It will single out that error only :) Commented Mar 23, 2019 at 19:16
  • 2
    Updated to reflect the above :) Commented Mar 23, 2019 at 19:20
  • Thanks a lot! Works like a charm:) Later I just kill it completely with pid = os.getpid() os.kill(pid, 9) and this clumsy solution is enough for me:) Commented Mar 23, 2019 at 19:27