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

Does not fall back to default wordlist if INFILE doesn't exist #43

bhavin192 opened this Issue Dec 29, 2017 · 3 comments


None yet
2 participants
Copy link

bhavin192 commented Dec 29, 2017

$ diceware nonexistingfile
Traceback (most recent call last):
  File "/home/bgandhi/diceware/py36/bin/diceware", line 11, in <module>
    load_entry_point('diceware==0.9.4.dev0', 'console_scripts', 'diceware')()
  File "/home/bgandhi/diceware/diceware/", line 211, in main
  File "/home/bgandhi/diceware/diceware/", line 184, in get_passphrase
    word_list = WordList(options.infile)
  File "/home/bgandhi/diceware/diceware/", line 126, in __init__
    self.fd = open(self.path, "r")
FileNotFoundError: [Errno 2] No such file or directory: 'nonexistingfile'
Exception ignored in: <bound method WordList.__del__ of <diceware.wordlist.WordList object at 0x7f94008f2dd8>>
Traceback (most recent call last):
  File "/home/bgandhi/diceware/diceware/", line 131, in __del__
AttributeError: 'WordList' object has no attribute 'fd'

I'm working on a patch for this.


This comment has been minimized.

Copy link

ulif commented Dec 30, 2017

Thank you @bhavin192 for your observation!

I agree that the error message looks confusing and should be more concise in case of "file-not-found".

But an error message is IMHO the correct way to signal a missing file to the user. Especially, if a file path was explicitly given. Therefore I'd oppose to fall back here to any default INFILE.

In my view, the right fix would be to make the error message better understandable. But please do not make the error disappear entirely.


This comment has been minimized.

Copy link
Contributor Author

bhavin192 commented Dec 31, 2017

Got your point, will it be better if we show an error like this?

The file <INFILE> not found, using default wordlist

or just show the error something like this one and stop?

The file <INFILE> does not exist!

This comment has been minimized.

Copy link

ulif commented Jan 1, 2018

I think the latter will be correct.

A user requesting myfile does not want any default file, he wants myfile. If it does not exist, let's tell him. I do not thinkl, we should try to be smart in that case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment