spacepaste

  1.  
  2. if __name__ == '__mp_main__':
  3. import sys
  4. sys.path = ['', '/home/arigo/pypysrc', '/home/arigo/lib/python', '/opt/pypy3/lib_pypy/__extensions__', '/opt/pypy3/lib_pypy', '/opt/pypy3/lib-python/3', '/opt/pypy3/lib-python/3/lib-tk', '/opt/pypy3/lib-python/3/plat-linux2', '/home/arigo/.local/lib/python3.5/site-packages', '/opt/pypy3/site-packages']
  5. import multiprocessing as mp
  6. import time
  7. def foo(x):
  8. return x**2
  9. if __name__ == '__main__':
  10. mp.set_start_method('spawn')
  11. mp.set_executable('/usr/bin/pypy3')
  12. pool = mp.Pool(1)
  13. pool.apply_async(foo, args=(12,), callback=print)
  14. time.sleep(1)
  15.