title: How to read files from USB connected phone in Python?
body: <p>I made a Python program that reads all the files in a directory who's path is inputted and then does some things to them and outputs some things into a .txt file.</p>
  
  <p>I used os.walk to read the files in the directory</p>
  
  <pre><code>def dir_read(pathName = str(), fileList=[]):  #fileList is output
      cur_dir = [i[2] for i in os.walk(pathName)] #current directory
      for i in cur_dir:
          for j in i:
              fileList.append(j)
  </code></pre>
  
  <p>and then checking for correctly inputted paths like this</p>
  
  <pre><code>fileList=[]
  
  while True:
      dir_read(pathName, fileList) #FUNCTION CALL
  
      if not fileList:  #if it is empty
        print("The path is written incorrectly, is empty or does not exist. Please re-enter now or "
                "close the program and enter it inside PATH.txt:")
        pathName = str(input())
      else:
          break    #if the list is not empty (the path is entered correctly) the while loop breaks
  </code></pre>
  
  <p>However if I enter something like <code>This PC\Nokia 6.1\Card SD</code> it keeps giving me the error message. Also I noticed same thing happens with things like Desktop or Documents. But if I enter something like <code>C:\Program Files (x86)\Notepad++</code> it works perfectly.</p>
  
  <p>I tried replacing <code>\</code> with <code>/</code> as well and it doesn't work. </p>
  
  <p>My phone doesn't have a specific drive like F: as you can see here: <a href="https://imgur.com/a/Educ5RJ" rel="nofollow noreferrer">https://imgur.com/a/Educ5RJ</a></p>
  
  <p>I am using Windows 10. </p>
  
  <p>How do I fix this?</p>