Scala Error (File Not Found Exception)

Scala Error (File Not Found Exception)
0.0 0


Hi Team,

I am trying to read a file from local system. The path of the file is at “/cygdrive/c/ITVERSITY_DUGA_DATA/electionresults/ls2014.tsv” . I am saving the file path to a value (val) and trying to read the file using Source.fromFile(fileName). I am getting “”. It is searching the file path as “\cygdrive\c\ITVERSITY_DUGA_DATA\electionresults\ls2014.tsv”. The source file is located at “/cygdrive/c/…” (with forward slash) but it is searching from “\cygdrive\c…” (back slash). Please find the screen shot for the same.


Downloading files to my local machine from github

The issue is resolved now. We need to provide the file path as
val fileName = “C:\\ITVERSITY_DUGA_DATA\\electionresults\\ls2014.tsv” (two backslash’s) to read the data file in windows.