1

I found the code below on the python website.

However the code does not compile on Windows 10 with Python 3.6.5 installed.

I've tried the same code on Ubuntu 16.04 (Python 2.7) and the code works fine.

from multiprocessing import Process

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

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

The error I get is shown below. I've only shown the last line of the stack trace since this seems to be where the error is generated. I've done a lot searching but have not found a solution.

File "J:\Programs\Python\Python36\lib\multiprocessing\context.py", line 321, in _Popen from .popen_spawn_win32 import Popen

ImportError: cannot import name 'Popen'

Thanks in advance for any help.

Smithy
  • 1,157
  • 3
  • 11
  • 18
  • Maybe this can help ==> https://stackoverflow.com/questions/29630217/multiprocessing-in-ipython-console-on-windows-machine-if-name-requirement – OddNorg Jun 01 '18 at 09:26
  • Tried that, no success. It may be that it's not possible to create processes on windows. – Smithy Jun 03 '18 at 08:42
  • I saw that people manage to create process using OS library. But your questions mentions the multiprocessing one. Did not answer that since that was not the question. But this solution might be helpful none the less : https://github.com/celery/billiard/issues/70 – OddNorg Jun 03 '18 at 12:35
  • Yes I'll use the OS library. Thanks. – Smithy Jun 08 '18 at 11:58

0 Answers0