title: Python :[Error 3] The system cannot find the path specified:
body: <pre><code>import os
  Current_Directory = os.getcwd() # Should be ...\archive
  CORPUS_PATHS = sorted([os.path.join(&quot;archive&quot;, directories) for directories in os.listdir(Current_Directory)])
  filenames = []
  for items in CORPUS_PATHS:
      filenames.append(sorted([os.path.join(CORPUS_PATHS, fn) for fn in os.listdir(items)]))
  
  print filenames
  </code></pre>
  <p>I am running this code from a file called archive and in archive there are more folders and in each of these folders, there are one or more text files. I want to make a list that includes the path to each of these folders. However the following error appears.</p>
  <pre><code>[Error 3] The system cannot find the path specified:
  </code></pre>
  <p>I currently have the python script where I wrote this code in the same folder as archive and it will trigger this error. What should I do in order to stop this error and get all the file paths.</p>
  <p>I am pretty bad at using os and I don't use it that often so I apologize if this is a trivial question.</p>
  <h3>Edit</h3>
  <pre><code>import os
  startpath = &quot;archive&quot;
  corpus_path = sorted([os.path.join(&quot;archive/&quot;, directories) for directories in os.listdir(startpath)])
  
  filenames = []
  for items in corpus_path:
      print items
      path = [os.path.join(corpus_path, fn) for fn in os.listdir(items)]
      print path
  </code></pre>
  <p>So I have made some progress and now I corpus path is essentially a list with the path to all of the desired folders. Now all I am trying to do is get all of the paths to the text files inside these folders but I still run into issues and I don't know how but error such as</p>
  <pre><code>File &quot;C:\Users\David\Anaconda\lib\ntpath.py&quot;, line 65, in join
  result_drive, result_path = splitdrive(path)
  
  File &quot;C:\Users\David\Anaconda\lib\ntpath.py&quot;, line 116, in splitdrive
  normp = p.replace(altsep, sep)
  
  AttributeError: 'list' object has no attribute 'replace'
  </code></pre>