SamLynnEvans/Transformer

error: file not found

Scum1254 opened this issue ยท 5 comments

how do i run this on my local pc? it always shows me that error: file not found.
even the files are in that folder. i tried all slash versions [/, \, //, \, ]nothing worked to find that folder or .txt file

Use pwd in linux or cd in windows to get current working directory and then try ls in Linux or dir in Windows to get the files and folders in that current working directory.
(Upload the snap of the terminal so I can get more info about the same.)

@its-Anshul what you've mentioned above seems to work just fine in my case.
terminal

Do this! (trying ls)

terminal

PS you do't need to mention the whole path of the english.txt file, writing -src_data data/english.text would be enough if there exists the english.txt file.

@srajan-jha Actually issue was with the data.
While reading the file it encountered the error and as written in code in Process.py :
try:
opt.src_data = open(opt.src_data).read().strip().split('\n')
except:
print("error: '" + opt.src_data + "' file not found")
quit()

it is printing file not found.

So fixed it by changing except as follows :

except Exception as e:
print("error: '" + str(e))
quit()

And hence found the real error.

Thanks for helping

@its-Anshul
Right.
In my case, the real mistake is UnicodeDecodeError.
I fixed it by adding encoding='utf-8':
opt.src_data = open(opt.src_data,encoding='utf-8').read().strip().split('\n')