title: Python 3 - Multiprocessing same function with different args
body: <p>In python 3, I am trying to run the same function with multiple arguments at the same time. I am using multiprocessing in Python 3.5.2, Anaconda 4.1.1 (64-bit), in Windows 7. I am getting the following error regarding spawn.py:</p>
  
  <blockquote>
    <p>An attempt has been made to start a new process before the
    current process has finished its bootstrapping phase.</p>
    
    <p>This probably means that you are not using fork to start your
    child processes and you have forgotten to use the proper idiom
    in the main module:</p>
  </blockquote>
  
  <pre><code>if __name__ == '__main__':
      freeze_support()
      ...
  </code></pre>
  
  <blockquote>
    <p>The "freeze_support()" line can be omitted if the program
    is not going to be frozen to produce an executable.</p>
  </blockquote>
  
  <p>My code is:</p>
  
  <pre><code>from multiprocessing import Process
  
  #Function to be run
  def savedatetime(password,rangestart,rangeend):
      print((password,rangestart,rangeend))
  
  # Inputs to the function
  passwords=['p0','p1','p2']
  ranges=[(1,10),(10,20),(20,30)]
  
  # Creating the list of processes to append
  fileind=0
  proc=[]
  for rangeind in range(0,len(passwords)):    
      password=passwords[fileind]
      rangestart=ranges[fileind][0]
      rangeend=ranges[fileind][1]
      p = Process(target=savedatetime,args=(password,rangestart,rangeend))            
      proc.append(p)
      fileind=fileind+1
      # running sequentially to check that the function works
      savedatetime(password,rangestart,rangeend)
  
  print(proc)
  
  # Attempting to run simultaneously. This is where the error occurs:
  for p in proc:
      p.start()
      p.join()
  </code></pre>
  
  <p>Could you please help me to fix my code so the multiple instances of the same function run simultaneously? Thanks!</p>