1
from multiprocessing import Process
import sys

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

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

This program isn't executing properly on my pc...But it works fine using online compiler

====================== RESTART: E:\Python\py_prac_9.py ======================
<Process(Process-1, stopped[1])> <class 'multiprocessing.context.Process'>
>>>

Expected OUTPUT:

====================== RESTART: E:\Python\py_prac_9.py ======================
hello bob
<Process(Process-1, stopped[1])> <class 'multiprocessing.context.Process'>
>>>

I'm using windows 8.1 with 3.5.4 python version...

Environmental Variables:

PATH:
C:\Users\Madhu G\AppData\Local\Programs\Python\Python35-32\;
C:\Users\Madhu G\AppData\Local\Programs\Python\Python35-32\Lib\site-packages\;
C:\Users\Madhu G\AppData\Local\Programs\Python\Python35-32\Scripts\;

Please suggest me the solution, even the daemon processes are not executing proper...Do I need to make any changes in my pc..

martineau
  • 119,623
  • 25
  • 170
  • 301
Madhu
  • 51
  • 1
  • 4

1 Answers1

0

It seems that you are working with Python under Windows. If you are starting the script via IDLE, it won't give you the expected output.

Try starting it via the command line.

Community
  • 1
  • 1
Maximilian Peters
  • 30,348
  • 12
  • 86
  • 99