'FileNotFoundError while debugging in Spyder

I am running a code in Spyder, which starts with the following line:

  f = open("../../../sbd-preprocess-master/data_proc/train.txt", 'r') 

The statement executes fine if I just run the code in a regular way. However, if I debug the file, I get a FileNotFoundError at the same line:

FileNotFoundError: [Errno 2] No such file or directory: '../../../sbd-preprocess-master/data_proc/train.txt'

Any idea why that is happening?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source