Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error: file not found #9

Open
Scum1254 opened this issue Jul 21, 2019 · 5 comments
Open

error: file not found #9

Scum1254 opened this issue Jul 21, 2019 · 5 comments

Comments

@Scum1254
Copy link

Scum1254 commented Jul 21, 2019

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

@srajan-jha
Copy link

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
Copy link

Screenshot (26)

@srajan-jha
Copy link

@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.

@its-Anshul
Copy link

@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

@SCNUJackyChen
Copy link

@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')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants