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 #16

Closed MrEdinLaw closed 5 years ago

MrEdinLaw commented 5 years ago

Describe the bug

site-packages\random_word\random_word.py", line 58, in get_random_word "Error occured, No result found. If you think this was a mistake than raise issue at {}".format(self.issue_url)) Exception: Error occured, No result found. If you think this was a mistake than raise issue at https://github.com/vaibhavsingh97/random-word/issues

To Reproduce Steps to reproduce the behavior:

r = RandomWords()
word = r.get_random_word()

Expected behavior Word variable should get a random word assigned.

Screenshots If applicable, add screenshots to help explain your problem. No....

Environment (please complete the following information):

Additional context Add any other context about the problem here.

vaibhavsingh97 commented 5 years ago

@MrEdinLaw Please update the package to the latest version. I had included the latest fix.

MrEdinLaw commented 5 years ago

Thank you very much, the latest update fixed the problem/bug.

atschutz commented 5 years ago

I reinstalled the package just now and I'm still getting this error.

vaibhavsingh97 commented 5 years ago

@atschutz I just did a reinstall to reproduce the error, but I am getting random words image Can you please help me in opening new issue with proper steps, and environment you are facing this issue

atschutz commented 5 years ago

Just submitted a new issue. Thanks for the quick reply!

FremanZhang commented 5 years ago

The same issue occurs in my APP today suddenly, but it was working well in the past. Is there any usage limit on the number of times ?

(wx-env) freman@DEV01:~/project/$ python
Python 3.6.8 (default, Jan 14 2019, 11:02:34) 
[GCC 8.0.1 20180414 (experimental) [trunk revision 259383]] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 
>>> from random_word import RandomWords
>>> nickname = RandomWords().get_random_word()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/freman/project/wechat/wx-env/lib/python3.6/site-packages/random_word/random_word.py", line 60, in get_random_word
    "Error occured, No result found. If you think this was a mistake than raise issue at {}".format(self.issue_url))
Exception: Error occured, No result found. If you think this was a mistake than raise issue at https://github.com/vaibhavsingh97/random-word/issues
>>> 
FremanZhang commented 5 years ago

The same issue occurs in my APP today suddenly, but it was working well in the past. Is there any usage limit on the number of times ?

(wx-env) freman@DEV01:~/project/$ python
Python 3.6.8 (default, Jan 14 2019, 11:02:34) 
[GCC 8.0.1 20180414 (experimental) [trunk revision 259383]] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> 
>>> from random_word import RandomWords
>>> nickname = RandomWords().get_random_word()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/freman/project/wechat/wx-env/lib/python3.6/site-packages/random_word/random_word.py", line 60, in get_random_word
    "Error occured, No result found. If you think this was a mistake than raise issue at {}".format(self.issue_url))
Exception: Error occured, No result found. If you think this was a mistake than raise issue at https://github.com/vaibhavsingh97/random-word/issues
>>> 

I checked the source code of 'random_word.py' and doubted that maybe this is a network issue regarding the API url 'https://api.wordnik.com/v4/words.json/randomWord?'

try:
url += urlencode(payload, quote_via=quote_plus)
except TypeError:
url += urlencode(payload)
response = request_url(url)
result = response.json()
if response.status_code == 200:
return result['word']
else:
raise Exception(
"Error occured, No result found. If you think this was a mistake than raise issue at {}".format(self.issue_url))

Then tried to switch by a better network line from China and it works. To sum up, the connection stability of the API service is a crucial factor.

ChemGuy88 commented 4 years ago

To sum up, the connection stability of the API service is a crucial factor.

This would explain the unpredictability in reproducing the error. Thanks for looking into it.