title: Spark [Python] - Reading local file in Windows
body: <p>I want to read a local file into spark. I'm using Windows. Used the following command:</p>
  
  <pre><code>input = sc.textFile("D://sample.txt")
  </code></pre>
  
  <p>I tried every possible combination, but constantly get the following or very similar error.</p>
  
  <p>I tried the following:</p>
  
  <ul>
  <li><p>adding file:/// and file://</p></li>
  <li><p>adding file:\\ and file:\</p></li>
  <li><p>D:/sample.txt</p></li>
  <li><p>D:\sample.txt</p></li>
  <li><p>D:\sample.txt</p></li>
  </ul>
  
  <p>The current working directory is D:\ and the file exists on D:\</p>
  
  <p>Anyone an idea?</p>
  
  <pre><code>&gt;&gt;&gt; input = sc.textFile("D://sample.txt")
  15/10/27 02:37:37 INFO MemoryStore: ensureFreeSpace(157288) called with curMem=7
  891904, maxMem=556038881
  15/10/27 02:37:37 INFO MemoryStore: Block broadcast_46 stored as values in memor
  y (estimated size 153.6 KB, free 522.6 MB)
  15/10/27 02:37:37 INFO MemoryStore: ensureFreeSpace(14276) called with curMem=80
  49192, maxMem=556038881
  15/10/27 02:37:37 INFO MemoryStore: Block broadcast_46_piece0 stored as bytes in
   memory (estimated size 13.9 KB, free 522.6 MB)
  15/10/27 02:37:37 INFO BlockManagerInfo: Added broadcast_46_piece0 in memory on
  localhost:52887 (size: 13.9 KB, free: 529.6 MB)
  15/10/27 02:37:37 INFO SparkContext: Created broadcast 46 from textFile at null:
  -1
  </code></pre>
  
  <p>Also, do we always use backslashes in the command line when using Windows? Or is it just for directories?</p>
  
  <p>Thanks a lot,
  cobby</p>