2

i have a problem.

i using python(2.7.7, 32bit) and py2exe(0.6.9) on Windows7(64bit).

my application structure such as the following:

from multiprocessing import Process

def child():
  print "child"

def main():
  print "main"
  p = Process(target=child)
  p.start()
  p.join()

if __name__ == "__main__":
  main()

(1)result before packaged:

main
child

(2)result after packaged:

main
main
main
...(forever)

i want to get (1) after packaging.

please tell me how to get (1) after packaging.

love.

rakou1986
  • 23
  • 2
  • 1
    try calling [`multiprocessing.freeze_support()`](https://docs.python.org/2/library/multiprocessing.html#multiprocessing.freeze_support) – mata Sep 23 '14 at 17:32

1 Answers1

1

As mentioned in the comments, you need a call to multiprocessing.freeze_support() when packaging a Python script into an executable for use on Windows. This call should come just after if __name__ == '__main__': before actually calling main().

Link to multiprocessing.freeze docs

skrrgwasme
  • 9,358
  • 11
  • 54
  • 84