Scala Error (File Not Found Exception)

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 “java.io.FileNotFoundException”. 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.

Thanks
Venu

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.

Thanks,
Venu

2 Likes