Input file doesn't exist even though the file is mentioned in the correct location- pyspark
<p>I'm trying to read log lines by forming key-value pairs but I get an error.
This is my code:</p>

<pre><code>logLine=sc.textFile("C:\TestLogs\testing.log").cache() 
lines = logLine.flatMap(lambda x: x.split('\n'))
rx = "(\\S+)=(\\S+)" 
line_collect = lines.collect() 
for line in line_collect :  
    d = dict([(x,y) for x,y in re.findall(rx,line)])    
    d = str(d)  
    print d
</code></pre>

<p>Error: </p>

<blockquote>
  <p>line_collect = lines.collect()......InvalidInputException: Input path
  does not exist: file:/C:/TestLogs  esting.log</p>
</blockquote>

<p>I don't know how to correct this. I'm new to python and spark. </p>

<p>Try replace <code>logLine=sc.textFile("C:\TestLogs\testing.log").cache()</code> with 
<code>logLine=sc.textFile("C:\\TestLogs\\testing.log").cache()</code></p>

<p>The backslash character is not <code>'\'</code> in a string but rather <code>"\\"</code></p>

python apache-spark pyspark