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 in 'get_random_wikipedia_article' routine in 'wikirandom.py' file #6

Open
AlanLesmerises opened this issue Jan 14, 2019 · 0 comments

Comments

@AlanLesmerises
Copy link

AlanLesmerises commented Jan 14, 2019

There appears to be a bug in Line 39 of the file:

'semanticpy/vendor/onlineldavb/wikirandom.py'

Repeated attempts to run the sample 'onlinewikipedia.py' code produced nothing but "nan" in the results. After considerable detective work, I isolated the problem to the RE search statement in the 'get_random_wikipedia_article' routine. It currently reads as follows:

result = re.search(r'title="Edit this page" href="/w/index.php\?title=(.*)\&action=edit" /\>', line)

Changing the end of the RE search criteria (as shown below) appears to correct it:

result = re.search(r'title="Edit this page" href="/w/index.php\?title=(.*)\&action=edit(.*)"', line)
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

1 participant