title: IsADirectoryError: [Errno 21] Is a directory: '/' error while using multiprocessing
body: <p>Say, I have a function to run multiple data frames in a list. Like this,</p>
  <pre><code>listdF = [os.path.join(os.sep,path,x) for x in os.listdir(path) if x.endswith('.csv')]
  def corre_arrys(listdF):
     data = []
  for files in listdF:
      df = pd.read_csv(files,sep='\t',header=0,engine='python')
      #do something
  return(df)
          
  </code></pre>
  <p>When I try to run the above function as it is, there is no error. It prints out the output I needed. However, when I try to run it using <code>multiprocessing</code> like follows,</p>
  <pre><code>from multiprocessing import Pool
  NUM_PROCS = 8    
  pool = Pool(processes=NUM_PROCS)
  allDfs = pool.map(corre_arrys,listdF)
  </code></pre>
  <p>It is throwing the following error message,</p>
  <pre><code>RemoteTraceback                           Traceback (most recent call last)
  RemoteTraceback: 
  &quot;&quot;&quot;
  Traceback (most recent call last):
    File &quot;/home/alva/anaconda3/lib/python3.7/multiprocessing/pool.py&quot;, line 121, in worker
      result = (True, func(*args, **kwds))
    File &quot;/home/alva/anaconda3/lib/python3.7/multiprocessing/pool.py&quot;, line 44, in mapstar
      return list(map(*args))
    File &quot;&lt;ipython-input-42-e4b97b52ffff&gt;&quot;, line 4, in corre_arrys
      df = pd.read_csv(files,sep='\t',header=0,engine='python')
    File &quot;/home/alva/anaconda3/lib/python3.7/site-packages/pandas/io/parsers.py&quot;, line 676, in parser_f
      return _read(filepath_or_buffer, kwds)
    File &quot;/home/alva/anaconda3/lib/python3.7/site-packages/pandas/io/parsers.py&quot;, line 448, in _read
      parser = TextFileReader(fp_or_buf, **kwds)
    File &quot;/home/alva/anaconda3/lib/python3.7/site-packages/pandas/io/parsers.py&quot;, line 880, in __init__
      self._make_engine(self.engine)
    File &quot;/home/alva/anaconda3/lib/python3.7/site-packages/pandas/io/parsers.py&quot;, line 1126, in _make_engine
      self._engine = klass(self.f, **self.options)
    File &quot;/home/alva/anaconda3/lib/python3.7/site-packages/pandas/io/parsers.py&quot;, line 2269, in __init__
      memory_map=self.memory_map,
    File &quot;/home/alva/anaconda3/lib/python3.7/site-packages/pandas/io/common.py&quot;, line 431, in get_handle
      f = open(path_or_buf, mode, errors=&quot;replace&quot;, newline=&quot;&quot;)
  IsADirectoryError: [Errno 21] Is a directory: '/'
  &quot;&quot;&quot;
  
  The above exception was the direct cause of the following exception:
  
  IsADirectoryError                         Traceback (most recent call last)
  &lt;ipython-input-46-4971753cdf30&gt; in &lt;module&gt;
        4 NUM_PROCS = 8
        5 pool = Pool(processes=NUM_PROCS)
  ----&gt; 6 allDfs = pool.map(corre_arrys,listdF)
  
  ~/anaconda3/lib/python3.7/multiprocessing/pool.py in map(self, func, iterable, chunksize)
      266         in a list that is returned.
      267         '''
  --&gt; 268         return self._map_async(func, iterable, mapstar, chunksize).get()
      269 
      270     def starmap(self, func, iterable, chunksize=None):
  
  ~/anaconda3/lib/python3.7/multiprocessing/pool.py in get(self, timeout)
      655             return self._value
      656         else:
  --&gt; 657             raise self._value
      658 
      659     def _set(self, i, obj):
  
  IsADirectoryError: [Errno 21] Is a directory: '/'
  </code></pre>
  <p>The <code>listDF</code> looks like the following, which has both paths and files.</p>
  <pre><code>['/path/scripts/pc_2_lc_1_T.csv',
   '/path/scripts/pc_2_lc_2_T.csv',
   '/path/scripts/pc_1_lc_1_T.csv',
   '/path/scripts/pc_1_lc_2_T.csv']
  </code></pre>
  <p>I am not able to understand where is the exact problem.</p>
  <p>Any help is greatly appreciated. Thanks!!</p>