title: "File format is not supported" while multi threading a list of pdf files
body: <p>I am teaching myself the basics of threading in python and am stuck.
  I want the script to apply a function to a list of pdfs. This function is simply supposed to count the number of tables in each pdf file and then return a combined list of how many tables each file has.</p>
  
  <p>Right now, I am getting a error stating that my “file format is not supported”. As far as I can tell each path in the list is a full path that ends with .pdf. I don’t know what I am doing wrong?</p>
  
  <p>I have stripped down the code to the salient points and have included my code below</p>
  
  <pre><code>import camelot
  from multiprocessing.dummy import Pool as ThreadPool 
  import glob
  import os
  
  
  #get a list of all the pdf paths in the directory I am interested in
  pdfs = [os.path.abspath(x) for x in os.listdir(r'C:\Users\josiahh\Desktop\threading_learning')]
  
  #format each path to have the r letter in front of it
  rpdfs = ["r'" + pdf + "'" for pdf in pdfs]
  
  #function that counts each table in the pdf. THIS IS WHERE SOMETHING IS WRONG...I THINK
  listoflengths = []
  def len_table5(filepath):    
      tables = camelot.read_pdf(filepath, pages = '1-end',flavor='stream')
      tablelength = len(tables)
      listoflengths.append(tablelength)
  
  #threading code
  pool = ThreadPool(5) 
  results = pool.map(len_table5, rpdfs)
  pool.close() 
  pool.join() 
  </code></pre>
  
  <p>Any help would be greatly appreciated. Please let me know if I can clarify anything</p>
  
  <p>EDIT:
  Traceback when using r's in front of the file names</p>
  
  <pre><code>---------------------------------------------------------------------------
  NotImplementedError                       Traceback (most recent call last)
  &lt;ipython-input-57-d38bdf75c567&gt; in &lt;module&gt;
        1 
        2 pool = ThreadPool(5)
  ----&gt; 3 results = pool.map(len_table5, rpdfs)
        4 pool.close()
        5 pool.join()
  
  ~\AppData\Local\Continuum\anaconda3\lib\multiprocessing\pool.py in map(self, func, iterable, chunksize)
      286         in a list that is returned.
      287         '''
  --&gt; 288         return self._map_async(func, iterable, mapstar, chunksize).get()
      289 
      290     def starmap(self, func, iterable, chunksize=None):
  
  ~\AppData\Local\Continuum\anaconda3\lib\multiprocessing\pool.py in get(self, timeout)
      668             return self._value
      669         else:
  --&gt; 670             raise self._value
      671 
      672     def _set(self, i, obj):
  
  ~\AppData\Local\Continuum\anaconda3\lib\multiprocessing\pool.py in worker(inqueue, outqueue, initializer, initargs, maxtasks, wrap_exception)
      117         job, i, func, args, kwds = task
      118         try:
  --&gt; 119             result = (True, func(*args, **kwds))
      120         except Exception as e:
      121             if wrap_exception and func is not _helper_reraises_exception:
  
  ~\AppData\Local\Continuum\anaconda3\lib\multiprocessing\pool.py in mapstar(args)
       42 
       43 def mapstar(args):
  ---&gt; 44     return list(map(*args))
       45 
       46 def starmapstar(args):
  
  &lt;ipython-input-54-025080eb0d6f&gt; in len_table5(filepath)
        1 listoflengths = []
        2 def len_table5(filepath):
  ----&gt; 3     tables = camelot.read_pdf(filepath, pages = '1-end',flavor='stream')
        4     tablelength = len(tables)
        5     listoflengths.append(tablelength)
  
  ~\AppData\Local\Continuum\anaconda3\lib\site-packages\camelot\io.py in read_pdf(filepath, pages, password, flavor, suppress_stdout, layout_kwargs, **kwargs)
      101 
      102         validate_input(kwargs, flavor=flavor)
  --&gt; 103         p = PDFHandler(filepath, pages=pages, password=password)
      104         kwargs = remove_extra(kwargs, flavor=flavor)
      105         tables = p.parse(flavor=flavor, suppress_stdout=suppress_stdout,
  
  ~\AppData\Local\Continuum\anaconda3\lib\site-packages\camelot\handlers.py in __init__(self, filepath, pages, password)
       33         self.filepath = filepath
       34         if not filepath.lower().endswith('.pdf'):
  ---&gt; 35             raise NotImplementedError("File format not supported")
       36 
       37         if password is None:
  
  NotImplementedError: File format not supported
  </code></pre>
  
  <p>Traceback when not using rs in the file path</p>
  
  <pre><code>---------------------------------------------------------------------------
  FileNotFoundError                         Traceback (most recent call last)
  &lt;ipython-input-59-07744a46a83f&gt; in &lt;module&gt;
        1 
        2 pool = ThreadPool(5)
  ----&gt; 3 results = pool.map(len_table5, pdfs)
        4 pool.close()
        5 pool.join()
  
  ~\AppData\Local\Continuum\anaconda3\lib\multiprocessing\pool.py in map(self, func, iterable, chunksize)
      286         in a list that is returned.
      287         '''
  --&gt; 288         return self._map_async(func, iterable, mapstar, chunksize).get()
      289 
      290     def starmap(self, func, iterable, chunksize=None):
  
  ~\AppData\Local\Continuum\anaconda3\lib\multiprocessing\pool.py in get(self, timeout)
      668             return self._value
      669         else:
  --&gt; 670             raise self._value
      671 
      672     def _set(self, i, obj):
  
  ~\AppData\Local\Continuum\anaconda3\lib\multiprocessing\pool.py in worker(inqueue, outqueue, initializer, initargs, maxtasks, wrap_exception)
      117         job, i, func, args, kwds = task
      118         try:
  --&gt; 119             result = (True, func(*args, **kwds))
      120         except Exception as e:
      121             if wrap_exception and func is not _helper_reraises_exception:
  
  ~\AppData\Local\Continuum\anaconda3\lib\multiprocessing\pool.py in mapstar(args)
       42 
       43 def mapstar(args):
  ---&gt; 44     return list(map(*args))
       45 
       46 def starmapstar(args):
  
  &lt;ipython-input-58-e6499958826d&gt; in len_table5(filepath)
       14 listoflengths = []
       15 def len_table5(filepath):
  ---&gt; 16     tables = camelot.read_pdf(filepath, pages = '1-end',flavor='stream')
       17     tablelength = len(tables)
       18     listoflengths.append(tablelength)
  
  ~\AppData\Local\Continuum\anaconda3\lib\site-packages\camelot\io.py in read_pdf(filepath, pages, password, flavor, suppress_stdout, layout_kwargs, **kwargs)
      101 
      102         validate_input(kwargs, flavor=flavor)
  --&gt; 103         p = PDFHandler(filepath, pages=pages, password=password)
      104         kwargs = remove_extra(kwargs, flavor=flavor)
      105         tables = p.parse(flavor=flavor, suppress_stdout=suppress_stdout,
  
  ~\AppData\Local\Continuum\anaconda3\lib\site-packages\camelot\handlers.py in __init__(self, filepath, pages, password)
       41             if sys.version_info[0] &lt; 3:
       42                 self.password = self.password.encode('ascii')
  ---&gt; 43         self.pages = self._get_pages(self.filepath, pages)
       44 
       45     def _get_pages(self, filepath, pages):
  
  ~\AppData\Local\Continuum\anaconda3\lib\site-packages\camelot\handlers.py in _get_pages(self, filepath, pages)
       64             page_numbers.append({'start': 1, 'end': 1})
       65         else:
  ---&gt; 66             infile = PdfFileReader(open(filepath, 'rb'), strict=False)
       67             if infile.isEncrypted:
       68                 infile.decrypt(self.password)
  
  FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\josiahh\\camelot - Copy (2) - Copy.pdf'
  </code></pre>