vaibhavsingh97 / random-word

This is a simple python package to generate random english words
https://pypi.org/project/random-word/
MIT License
123 stars 25 forks source link

Error: No result found after .py file containing get_random_word() call is run multiple times #17

Closed atschutz closed 3 years ago

atschutz commented 5 years ago

Describe the bug After running a .py file that uses get_random_word() or get_random_words() multiple times (usually around 10 times), Error occurs and will continue to occur if user tries to run the file again.

To Reproduce Steps to reproduce the behavior:

  1. Create a file named "randomWordTest.py" and fill it with the following:

    from random_word import RandomWords
    r = RandomWords()
    r.get_random_word()
  2. In the command prompt, navigate to the file's location and run "python randomWordTest.py" A random word should appear.

  3. repeat step 2 multiple times, around 10. Eventually, the following error will occur:

    Error occurred, No result found. If you think this was a mistake than raise issue at {}".format(self.issue_url))
    Exception: Error occurred, No result found. If you think this was a mistake than raise issue at https://github.com/vaibhavsingh97/random-word/issues

    This error will continue to occur about 95% of the time whenever randomWordTest.py is run. Changing the file and then saving it seems to bring user back to step 1.

Expected behavior randomWordTest.py should return a random word every time.

Environment (please complete the following information):

Additional context I'm new to python, so there's a chance I'm doing something incorrectly. I seem to have followed all steps for installation and usage of the package correctly, though.

vaibhavsingh97 commented 5 years ago

@atschutz Thanks for such detailed bug report 👍. I am looking into it, most probably it's an API limit, as right now, it's a free tier. I had asked the same questions on support, will update with the reply.

lwyss commented 5 years ago

Same thing happens to me on Mac but I am also new to python.

UPDATE: I found out that the more specific the parameters are the more likely it is to have an error. For example with no parameters, it rarely happens. Perhaps the database where you are getting the words from is too small or does not have enough words with these specific restrictions. Either way the error message should be different.

Hoohm commented 5 years ago

Got the same issue.

Puhalenthi commented 4 years ago

Same thing with me

simonm3 commented 4 years ago

same

kronk87 commented 4 years ago

Same

n1tishc commented 4 years ago

The same error occurred on my Mac

pqrollan commented 4 years ago

Still having the error

QxMar commented 4 years ago

same

K4K4SH11 commented 4 years ago

@vaibhavsingh97 are you still planning on implementing a fix? A nice way would be to make an exception so the error can be handled, wait for a number of seconds then retry.

vaibhavsingh97 commented 3 years ago

I had released a new version on PyPI (https://pypi.org/project/Random-Word/1.0.6/), this will fix recent issues.