0


I am using a BananaPi M3 running a Raspbian on it and a Python 2.7. I am trying to make a short demo on how to open separate Process on it:

from multiprocessing import Process

def f(name):
    print 'hello', name

if __name__ == '__main__':
    print "Starting test"
    p = Process(target=f, args=('bob',))
    p.start()
    p.join()

When creating the Process it hangs without an Error. enter image description here

Lucian
  • 874
  • 11
  • 33
  • can you try what happens if you comment out p.join()? – Johannes Hinrichs Sep 22 '16 at 15:25
  • It doesn't reach p.join(), so nothing happens if I take it out – Lucian Sep 22 '16 at 17:54
  • hmm are you sure? Have you tested where exactly it hangs, e.g. by putting a print after every line in the main code? because even if you have no p.join(), launch the subprocess (successfully) and then have an infinite loop in the subprocess, the main code would not exit before the subprocess does, so you wouldn't notice a difference. – Johannes Hinrichs Sep 22 '16 at 19:27
  • You are right, it reaches p.join() but doesn;t get passed it. If I take p.join() out it still behaves the same, it looks like it is hanged. – Lucian Sep 23 '16 at 07:53
  • Actually, after some investigation I noticed that the root of the problem was the fact that I ran the script with "Python Shell 2.7.9", the default running shell from Raspbian when executing python scripts. If I switch to run the script in a "Terminal" it works. I also tried to run the script from ssh from another PC and it worked. It seems that the default "Python Shell" has some issues with running processes in a script. So, no duplicate. – Lucian Sep 28 '16 at 12:57

0 Answers0