title: OSError: [WinError87] The parameter is incorrect
body: <p>I have a python script written using python 3.4.3 and it pulls in a .csv file of ip addresses, usernames, and passwords to pass to another batch script. </p>
  
  <pre><code>import pdb
  import csv
  import os
  import subprocess
  import datetime
  import time
  import signal
  from multiprocessing import Process
  
  def callGetDimmBatchFile(logFile, batchFileName, ipAddress, userName, passWord):
      print('\nId: {0}'.format(counter) + '\n', file=logFile, flush=True)
      command ='{0} -i {1} -u {2} -p {3}'.format(batchFileName, ipAddress, userName, passWord)
      print(command, file=logFile, flush=True)
      print("IP Address is {0}".format(ipAddress))
      print("User name is {0}".format(userName))
      print("Password is {0}".format(passWord))
      timeout = 60
      start = datetime.datetime.now()
      process = subprocess.Popen(command, stdout=logFile, stderr=logFile)
      while process.poll() is None:
          time.sleep(0.1)
          now = datetime.datetime.now()
          if (now - start).seconds &gt; timeout:
              process.kill()
              # os.kill(process.pid, signal.SIGKILL)
              # os.waitpid(-1, os.Warning)
              return None
      rc = process.wait()
      print('\nReturn Code:', rc, file=logFile, flush=True)
  
  
  logFile = open('log.txt', 'w+')
  batchFileName = 'getfoo.bat'
  pathToCsv = 'autorun-input.csv'
  print('Path to CSV is {0}'.format(pathToCsv))
  counter = 0
  with open(pathToCsv) as csvFile:
      reader = csv.reader(csvFile, delimiter=',')
      for row in reader:
          ipAddress = row[0]
          userName = row[1]
          passWord = row[2]
          p = Process(target=callGetDimmBatchFile, args=(logFile, batchFileName, ipAddress, userName, passWord))
          p.start()
          p.join()
  
  
          #callGetDimmBatchFile(logFile, batchFileName, ipAddress, userName, passWord)
  
  os.system("pause")
  </code></pre>
  
  <p>The file (autorun-input.csv) that it reads in is this: </p>
  
  <pre><code>10.69.69.1,taclab,taclab
  10.69.69.2,taclab,taclab
  10.69.69.3,taclab,taclab
  10.69.69.4,taclab,taclab
  10.69.69.5,taclab,taclab
  10.69.69.6,taclab,taclab
  10.69.69.7,taclab,taclab
  10.69.69.8,taclab,taclab
  10.69.69.9,taclab,taclab
  10.69.69.10,taclab,taclab
  </code></pre>
  
  <p>It is not working on several Windows 7 machines, the error is this:</p>
  
  <pre><code>C:\Users\Taclab\Desktop\DimmScript\Python-Project-9\Python-Project\DimmReport&gt;python autorun.py
  Path to CSV is autorun-input.csv
  Traceback (most recent call last):
    File "autorun.py", line 44, in &lt;module&gt;
      p.start()
    File "C:\Python34\lib\multiprocessing\process.py", line 105, in start
      self._popen = self._Popen(self)
    File "C:\Python34\lib\multiprocessing\context.py", line 212, in _Popen
      return _default_context.get_context().Process._Popen(process_obj)
    File "C:\Python34\lib\multiprocessing\context.py", line 313, in _Popen
      return Popen(process_obj)
    File "C:\Python34\lib\multiprocessing\popen_spawn_win32.py", line 66, in __ini
  t__
      reduction.dump(process_obj, to_child)
    File "C:\Python34\lib\multiprocessing\reduction.py", line 59, in dump
      ForkingPickler(file, protocol).dump(obj)
  TypeError: cannot serialize '_io.TextIOWrapper' object
  
  C:\Users\Taclab\Desktop\DimmScript\Python-Project-9\Python-Project\DimmReport&gt;Tr
  aceback (most recent call last):
    File "&lt;string&gt;", line 1, in &lt;module&gt;
    File "C:\Python34\lib\multiprocessing\spawn.py", line 100, in spawn_main
      new_handle = steal_handle(parent_pid, pipe_handle)
    File "C:\Python34\lib\multiprocessing\reduction.py", line 81, in steal_handle
      _winapi.PROCESS_DUP_HANDLE, False, source_pid)
  OSError: [WinError 87] The parameter is incorrect
  </code></pre>
  
  <p>I don't understand which <code>parameter</code> is incorrect. It appears the exception is thrown at <code>p.open</code>.</p>