Introduction
Introduction Statistics Contact Development Disclaimer Help
Fix ugly error, where wikipedia module did not return proper article. - annna -…
git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws6…
Log
Files
Refs
Tags
README
---
commit af74831fa0b8078dc34540d557d277d78c367123
parent 64e7fbce2f00b085fbcd25c164180a4a38272282
Author: Annna Robert-Houdin <[email protected]>
Date: Sat, 15 Apr 2023 22:35:54 +0200
Fix ugly error, where wikipedia module did not return proper article.
Diffstat:
M wikipediagame | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
---
diff --git a/wikipediagame b/wikipediagame
@@ -61,7 +61,14 @@ def main(args):
continue
if title == None:
- title = str(w.random())
+ summary = None
+ while summary == None:
+ title = str(w.random())
+ try:
+ summary = w.summary(title)
+ except (w.exceptions.DisambiguationError, wikipedia.exceptions…
+ continue
+
if os.path.exists(hintpath):
os.remove(hintpath)
if os.path.exists(titlepath):
You are viewing proxied material from bitreich.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.