Hi All, I'm new to Pywikibot (and Mediawiki as well). I've used the instructions on [0] to install pywikibot on my Windows laptop accessing a Linux server. All seems to be connected right (I'm successfully through step 9 and can login). The next step is to run add_text to change text on some pages. Here I get an error: C:\Users\Owner\pywikibot>python pwb.py add_text.py -cat:Testing -text:"Testing the add_text script using the Pywikibot user." -except:"{{([Tt]emplate:|)[Dd]ocumentation [Ss]ubpage" -upTraceback (most recent call last): File "pwb.py", line 270, in <module> if not main(): File "pwb.py", line 264, in main run_python_file(filename, [filename] + args, argvu, file_package) File "pwb.py", line 109, in run_python_file main_mod.__dict__) File ".\scripts\add_text.py", line 358, in <module> main() File ".\scripts\add_text.py", line 338, in main genFactory.handleArg(arg) File "C:\Users\Owner\pywikibot\pywikibot\pagegenerators.py", line 589, in handleArg gen = self.getCategoryGen(arg, gen_func=CategorizedPageGenerator) File "C:\Users\Owner\pywikibot\pywikibot\pagegenerators.py", line 420, in getCategoryGen if prefix not in self.site.namespaces[14]: File "C:\Users\Owner\pywikibot\pywikibot\site.py", line 806, in namespaces self._namespaces = _NamespacesDict(self._build_namespaces()) File "C:\Users\Owner\pywikibot\pywikibot\site.py", line 2185, in _build_namespaces if item['*'] not in _namespaces[ns]:KeyError: 104<class 'KeyError'>CRITICAL: Waiting for 1 network thread(s) to finish. Press ctrl-c to abort
I've verified the Category name exists and is spelled correctly. Not sure what to try next to figure this out. Any help is appreciated. Thanks,Bud Loveall P.S. Also, is there a way to search the archives of the mail list? I'm guessing this has been answered before.
Could you geve us your family and site you worked on. And the result of pwb.py version
Thanks
xqt
----- Original Nachricht ---- Von: Bud bloveall@yahoo.com An: "pywikibot@lists.wikimedia.org" pywikibot@lists.wikimedia.org Datum: 10.09.2016 02:54 Betreff: [pywikibot] Newbie Q: Error running add_text script for first time
Hi All, I'm new to Pywikibot (and Mediawiki as well). I've used the instructions on [0] to install pywikibot on my Windows laptop accessing a Linux server. All seems to be connected right (I'm successfully through step 9 and can login). The next step is to run add_text to change text on some pages. Here I get an error: C:\Users\Owner\pywikibot>python pwb.py add_text.py -cat:Testing -text:"Testing the add_text script using the Pywikibot user." -except:"{{([Tt]emplate:|)[Dd]ocumentation [Ss]ubpage" -upTraceback (most recent call last): File "pwb.py", line 270, in <module> if not main(): File "pwb.py", line 264, in main run_python_file(filename, [filename] + args, argvu, file_package) File "pwb.py", line 109, in run_python_file main_mod.__dict__) File ".\scripts\add_text.py", line 358, in <module> main() File ".\scripts\add_text.py", line 338, in main genFactory.handleArg(arg) File "C:\Users\Owner\pywikibot\pywikibot\pagegenerators.py", line 589, in handleArg gen = self.getCategoryGen(arg, gen_func=CategorizedPageGenerator) File "C:\Users\Owner\pywikibot\pywikibot\pagegenerators.py", line 420, in getCategoryGen if prefix not in self.site.namespaces[14]: File "C:\Users\Owner\pywikibot\pywikibot\site.py", line 806, in namespaces self._namespaces = _NamespacesDict(self._build_namespaces()) File "C:\Users\Owner\pywikibot\pywikibot\site.py", line 2185, in _build_namespaces if item['*'] not in _namespaces[ns]:KeyError: 104<class 'KeyError'>CRITICAL: Waiting for 1 network thread(s) to finish. Press ctrl-c to abort
I've verified the Category name exists and is spelled correctly. Not sure what to try next to figure this out. Any help is appreciated. Thanks,Bud Loveall P.S. Also, is there a way to search the archives of the mail list? I'm guessing this has been answered before.
pywikibot mailing list pywikibot@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikibot
It's a third-party wiki site that I've set up for testing, not one of the ones predefined. I've given it family name of colbuddysandbox. Here's the result of pwb.py version: Pywikibot: pywikibot/__init__.py (c4ccfae, -1 (unknown), 2016/09/09, 07:02:06, n/a)Release version: 2.0rc5httplib2 version: 0.9.1 cacerts: C:\Users\Owner\pywikibot\externals\httplib2\python3\httplib2\cacerts.txt certificate test: okPython: 3.5.2 (v3.5.2:4def2a2901a5, Jun 25 2016, 22:01:18) [MSC v.1900 32 bit (Intel)] unicode test: okPYWIKIBOT2_DIR: Not setPYWIKIBOT2_DIR_PWB:PYWIKIBOT2_NO_USER_CONFIG: Not setConfig base dir: C:\Users\Owner\pywikibotUsernames for family "colbuddysandbox": en: Pywikibot (no sysop configured) Thanks,Bud
From: "info@gno.de" info@gno.de To: bloveall@yahoo.com; pywikibot@lists.wikimedia.org Sent: Saturday, September 10, 2016 4:21 AM Subject: Aw: [pywikibot] Newbie Q: Error running add_text script for first time
Could you geve us your family and site you worked on. And the result of pwb.py version
Thanks
xqt
----- Original Nachricht ---- Von: Bud bloveall@yahoo.com An: "pywikibot@lists.wikimedia.org" pywikibot@lists.wikimedia.org Datum: 10.09.2016 02:54 Betreff: [pywikibot] Newbie Q: Error running add_text script for first time
Hi All, I'm new to Pywikibot (and Mediawiki as well). I've used the instructions on [0] to install pywikibot on my Windows laptop accessing a Linux server. All seems to be connected right (I'm successfully through step 9 and can login). The next step is to run add_text to change text on some pages. Here I get an error: C:\Users\Owner\pywikibot>python pwb.py add_text.py -cat:Testing -text:"Testing the add_text script using the Pywikibot user." -except:"{{([Tt]emplate:|)[Dd]ocumentation [Ss]ubpage" -upTraceback (most recent call last): File "pwb.py", line 270, in <module> if not main(): File "pwb.py", line 264, in main run_python_file(filename, [filename] + args, argvu, file_package) File "pwb.py", line 109, in run_python_file main_mod.__dict__) File ".\scripts\add_text.py", line 358, in <module> main() File ".\scripts\add_text.py", line 338, in main genFactory.handleArg(arg) File "C:\Users\Owner\pywikibot\pywikibot\pagegenerators.py", line 589, in handleArg gen = self.getCategoryGen(arg, gen_func=CategorizedPageGenerator) File "C:\Users\Owner\pywikibot\pywikibot\pagegenerators.py", line 420, in getCategoryGen if prefix not in self.site.namespaces[14]: File "C:\Users\Owner\pywikibot\pywikibot\site.py", line 806, in namespaces self._namespaces = _NamespacesDict(self._build_namespaces()) File "C:\Users\Owner\pywikibot\pywikibot\site.py", line 2185, in _build_namespaces if item['*'] not in _namespaces[ns]:KeyError: 104<class 'KeyError'>CRITICAL: Waiting for 1 network thread(s) to finish. Press ctrl-c to abort
I've verified the Category name exists and is spelled correctly. Not sure what to try next to figure this out. Any help is appreciated. Thanks,Bud Loveall P.S. Also, is there a way to search the archives of the mail list? I'm guessing this has been answered before.
pywikibot mailing list pywikibot@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikibot
I've done some debugging and this is what I've found so far: 1) the key error 104 is thrown because _namespaces[104] does not exist as a dict entry in site.py code (I enjoy the humor of the error message number and the index to the _namespaces dict being the same number!) 2) I found out that namespace ID 104 is from Semantic MediaWiki (which I have installed) but is no longer used. 3) So, it appears as though it is a bug related to SMW rather than pywikibot. It seems like the easy work around is just to create the 104 and 105 namespaces (unless they are already there [how do I find that out?]...and, being a newbie, I haven't created a namespace yet....more to learn!). What seems like the better fix, though, is to determine where pywikibot is picking up the namespace id's from and have it not search for 104 and 105. I'm now searching for that info, but if anyone knows that and can respond, I would appreciate it. Thanks,Bud
From: "info@gno.de" info@gno.de To: bloveall@yahoo.com; pywikibot@lists.wikimedia.org Sent: Saturday, September 10, 2016 4:21 AM Subject: Aw: [pywikibot] Newbie Q: Error running add_text script for first time
Could you geve us your family and site you worked on. And the result of pwb.py version
Thanks
xqt
----- Original Nachricht ---- Von: Bud bloveall@yahoo.com An: "pywikibot@lists.wikimedia.org" pywikibot@lists.wikimedia.org Datum: 10.09.2016 02:54 Betreff: [pywikibot] Newbie Q: Error running add_text script for first time
Hi All, I'm new to Pywikibot (and Mediawiki as well). I've used the instructions on [0] to install pywikibot on my Windows laptop accessing a Linux server. All seems to be connected right (I'm successfully through step 9 and can login). The next step is to run add_text to change text on some pages. Here I get an error: C:\Users\Owner\pywikibot>python pwb.py add_text.py -cat:Testing -text:"Testing the add_text script using the Pywikibot user." -except:"{{([Tt]emplate:|)[Dd]ocumentation [Ss]ubpage" -upTraceback (most recent call last): File "pwb.py", line 270, in <module> if not main(): File "pwb.py", line 264, in main run_python_file(filename, [filename] + args, argvu, file_package) File "pwb.py", line 109, in run_python_file main_mod.__dict__) File ".\scripts\add_text.py", line 358, in <module> main() File ".\scripts\add_text.py", line 338, in main genFactory.handleArg(arg) File "C:\Users\Owner\pywikibot\pywikibot\pagegenerators.py", line 589, in handleArg gen = self.getCategoryGen(arg, gen_func=CategorizedPageGenerator) File "C:\Users\Owner\pywikibot\pywikibot\pagegenerators.py", line 420, in getCategoryGen if prefix not in self.site.namespaces[14]: File "C:\Users\Owner\pywikibot\pywikibot\site.py", line 806, in namespaces self._namespaces = _NamespacesDict(self._build_namespaces()) File "C:\Users\Owner\pywikibot\pywikibot\site.py", line 2185, in _build_namespaces if item['*'] not in _namespaces[ns]:KeyError: 104<class 'KeyError'>CRITICAL: Waiting for 1 network thread(s) to finish. Press ctrl-c to abort
I've verified the Category name exists and is spelled correctly. Not sure what to try next to figure this out. Any help is appreciated. Thanks,Bud Loveall P.S. Also, is there a way to search the archives of the mail list? I'm guessing this has been answered before.
pywikibot mailing list pywikibot@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikibot
Now the add_text.py script is working. My best guess as to why is that I had namespacealiases in cache that were incorrect and then the cache either expired or was overwritten. Why I think that: My debugging led me to the _build_namespaces function in site.py. It does two api calls to siteinfo.get. One to get the namespaces and one to get the namespacealiases. The second call then iterates through the result set looking for ['*'] in the namespace dictionary (returned from the siteinfo.get for namespace). It was here that the script failed. It was looking for namespace 104 (which doesn't exist on my wiki and did not get loaded into the siteinfo.get for namespace). For some unknown reason, it did get loaded into the namespacealiases dict. In trying to determine what namespaces and namespace aliases were actually installed on my wiki, I queried api.php through my browser using this format: example.com/wiki/api.php?action=query&meta=siteinfo&siprop=namespaces&formatversion=2 and then again changing siprop=namespaces to siprop=namespacealiases. Both of these queries verified that neither namespace alias nor namespace 104 (and 105) exist on my wiki. After executing these two queries, I added a couple of pywikibot.output statements in site.py to see if I could determine more info with what it is what retrieving in the siteinfo function. It was then that the script worked correctly. My guess is that executing the api.php query for namespacealiases refreshed the cache thereby removing the alias to ns 104. It's a total guess, but all seems to be working now. Thanks again for your help.Bud
From: "info@gno.de" info@gno.de To: bloveall@yahoo.com; pywikibot@lists.wikimedia.org Sent: Saturday, September 10, 2016 4:21 AM Subject: Aw: [pywikibot] Newbie Q: Error running add_text script for first time
Could you geve us your family and site you worked on. And the result of pwb.py version
Thanks
xqt
----- Original Nachricht ---- Von: Bud bloveall@yahoo.com An: "pywikibot@lists.wikimedia.org" pywikibot@lists.wikimedia.org Datum: 10.09.2016 02:54 Betreff: [pywikibot] Newbie Q: Error running add_text script for first time
Hi All, I'm new to Pywikibot (and Mediawiki as well). I've used the instructions on [0] to install pywikibot on my Windows laptop accessing a Linux server. All seems to be connected right (I'm successfully through step 9 and can login). The next step is to run add_text to change text on some pages. Here I get an error: C:\Users\Owner\pywikibot>python pwb.py add_text.py -cat:Testing -text:"Testing the add_text script using the Pywikibot user." -except:"{{([Tt]emplate:|)[Dd]ocumentation [Ss]ubpage" -upTraceback (most recent call last): File "pwb.py", line 270, in <module> if not main(): File "pwb.py", line 264, in main run_python_file(filename, [filename] + args, argvu, file_package) File "pwb.py", line 109, in run_python_file main_mod.__dict__) File ".\scripts\add_text.py", line 358, in <module> main() File ".\scripts\add_text.py", line 338, in main genFactory.handleArg(arg) File "C:\Users\Owner\pywikibot\pywikibot\pagegenerators.py", line 589, in handleArg gen = self.getCategoryGen(arg, gen_func=CategorizedPageGenerator) File "C:\Users\Owner\pywikibot\pywikibot\pagegenerators.py", line 420, in getCategoryGen if prefix not in self.site.namespaces[14]: File "C:\Users\Owner\pywikibot\pywikibot\site.py", line 806, in namespaces self._namespaces = _NamespacesDict(self._build_namespaces()) File "C:\Users\Owner\pywikibot\pywikibot\site.py", line 2185, in _build_namespaces if item['*'] not in _namespaces[ns]:KeyError: 104<class 'KeyError'>CRITICAL: Waiting for 1 network thread(s) to finish. Press ctrl-c to abort
I've verified the Category name exists and is spelled correctly. Not sure what to try next to figure this out. Any help is appreciated. Thanks,Bud Loveall P.S. Also, is there a way to search the archives of the mail list? I'm guessing this has been answered before.
pywikibot mailing list pywikibot@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/pywikibot