title: Python multiprocessing Process() doesn't work on Windows 10 (even for pickling simple strings)
body: <p>I wrote a Python class to plot pylots in parallel. It works fine on Linux but when I tried it on Windows I ran into problems. It went even that far that I can't pickle a single string. I always end up getting this error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "test.py", line 50, in &lt;module&gt;
      test()
    File "test.py", line 7, in test
      asyncPlotter.saveLinePlotVec3("test")
    File "test.py", line 41, in saveLinePlotVec3
      args=(test, ))
    File "test.py", line 34, in process
      p.start()
    File "C:\Users\adrian\AppData\Local\Programs\Python\Python37\lib\multiprocessing\process.py", line 112, in start
      self._popen = self._Popen(self)
    File "C:\Users\adrian\AppData\Local\Programs\Python\Python37\lib\multiprocessing\context.py", line 223, in _Popen
      return _default_context.get_context().Process._Popen(process_obj)
    File "C:\Users\adrian\AppData\Local\Programs\Python\Python37\lib\multiprocessing\context.py", line 322, in _Popen
      return Popen(process_obj)
    File "C:\Users\adrian\AppData\Local\Programs\Python\Python37\lib\multiprocessing\popen_spawn_win32.py", line 89, in __init__
      reduction.dump(process_obj, to_child)
    File "C:\Users\adrian\AppData\Local\Programs\Python\Python37\lib\multiprocessing\reduction.py", line 60, in dump
      ForkingPickler(file, protocol).dump(obj)
  TypeError: can't pickle weakref objects
  
  C:\Python\MonteCarloTools&gt;Traceback (most recent call last):
    File "&lt;string&gt;", line 1, in &lt;module&gt;
    File "C:\Users\adrian\AppData\Local\Programs\Python\Python37\lib\multiprocessing\spawn.py", line 99, in spawn_main
      new_handle = reduction.steal_handle(parent_pid, pipe_handle)
    File "C:\Users\adrian\AppData\Local\Programs\Python\Python37\lib\multiprocessing\reduction.py", line 82, in steal_handle
      _winapi.PROCESS_DUP_HANDLE, False, source_pid)
  OSError: [WinError 87] The parameter is incorrect
  </code></pre>
  
  <p>I narrowed it down to the spawn start method that Windows uses (<a href="https://docs.python.org/3/library/multiprocessing.html#contexts-and-start-methods" rel="nofollow noreferrer">https://docs.python.org/3/library/multiprocessing.html#contexts-and-start-methods</a>), when I use the same start method on Linux I can reproduce the error.</p>
  
  <pre class="lang-py prettyprint-override"><code>import multiprocessing as mp
  def test():
  
      asyncPlotter = AsyncPlotter()
  
      asyncPlotter.saveLinePlotVec3("test")
  
      asyncPlotter.saveLinePlotVec3("test")
  
      asyncPlotter.saveLinePlotVec3("test")
  
      asyncPlotter.join()
  
  
  class AsyncPlotter():
  
      def __init__(self, processes=mp.cpu_count()):
  
          self.manager = mp.Manager()
          self.nc = self.manager.Value('i', 0)
          self.pids = []
          self.processes = processes
  
  
      def linePlotVec3(self, nc, processes, test):
  
          self.waitOnPool(nc, processes)
  
          return None
  
  
      def waitOnPool(self, nc, processes):
  
          while nc.value &gt;= processes:
              time.sleep(0.1)
          nc.value += 1
  
  
      def process(self, target, args):
  
          p = mp.Process(target=target, args=args)
          p.start()
          self.pids.append(p)
  
  
      def saveLinePlotVec3(self, test):
  
          self.process(target=self.linePlotVec3,
                         args=(self.nc, self.processes, test))
  
  
      def join(self):
          for p in self.pids:
              p.join()
  
  
  if __name__=='__main__':
      test()
  </code></pre>
  
  <p>I expect that I can pickle any kind of string, list, dict etc with this method on Windows as well. I'd appreciate if someone could find a way to make this work on Windows. Thanks!</p>