Python multiprocess debugging
debugging, multiprocessing, pycharm, python, winpdb
Solution
I found it very useful to replace `multiprocessing.Process()` with `threading.Thread()` when I'm going to set breakpoints. Both classes have similar arguments so in most cases they are interchangeable.
Usually my scripts use `Process()` until I specify command line argument `--debug` which effectively replaces those calls with `Thread()`. That allows me to debug those scripts with `pdb`.
Problem
I'm trying to debug a simple python application but no luck so far. ``` import multiprocessing def worker(num): for a in range(0, 10): print a if __name__ == '__main__': for i in range(5): p = multiprocessing.Process(target=worker, args=(i,)) p.start() ``` I want to set a breakpoint inside the for-loop to track the values of 'a' but non of the tools that I tried are able to do that. So far I tried debuging with: - PyCharm and get the following error: ImportError: No module named pydevd - http://youtrack.jetbrains.com/issue/PY-6649 It looks like they are still working on a fix for this and from what I understand, no ETA on this - I also tried debuging with Winpdb - http://winpdb.org but it simply won't go inside my 'worker' method and just print the values of 'a' I would really appreciate any help with this!