login.py works.
[root@mustang pywikipedia]# python login.py
Password for user Wikibot on mustang:en:
Logging in to mustang:en as Wikibot
Should be logged in now
[root@mustang pywikipedia]#
test.py fails
[root@mustang pywikipedia]# python test.py
Error downloading data: No JSON object could be decoded
Request
en:/w/api.php?action=query&format=json&meta=userinfo&uiprop=blockinfo
Retrying in 1 minutes...
^CTraceback (most recent call last):
File "test.py", line 50, in <module>
main()
File "test.py", line 46, in main
show(wikipedia.getSite())
File "test.py", line 21, in show
if mysite.loggedInAs():
File "/home/rwright/pywikipedia/wikipedia.py", line 4707, in loggedInAs
self._load(sysop = sysop)
File "/home/rwright/pywikipedia/wikipedia.py", line 5494, in _load
text = self.getUrl(url, sysop = sysop)
File "/home/rwright/pywikipedia/wikipedia.py", line 5112, in getUrl
self._getUserData(text, sysop = sysop)
File "/home/rwright/pywikipedia/wikipedia.py", line 5231, in _getUserData
blocked = self._getBlock(sysop = sysop)
File "/home/rwright/pywikipedia/wikipedia.py", line 4752, in _getBlock
data = query.GetData(params, self)['query']['userinfo']
File "/home/rwright/pywikipedia/query.py", line 120, in GetData
time.sleep(retry_idle_time*60)
KeyboardInterrupt
[root@mustang pywikipedia]#
I have api.php installed.
[root@mustang pywikipedia]# ls /var/www/html/w/api.php
/var/www/html/w/api.php
[root@mustang
/var/www/html/w/ is a sym link from /var/www/html/wiki/
I have found several posts with this error, bit no resolutions that are
applicable.
---Robert
Go the login issues resolved thanks to Nicolas.
However, the only script that works is login.py
The others fails with this error:
Error downloading data: No JSON object could be decoded
Request
en:/w/api.php?action=query&format=json&meta=userinfo&uiprop=blockinfo
Retrying in 1 minutes...
test.py
[root@mustang pywikipedia]# python test.py
Error downloading data: No JSON object could be decoded
Request
en:/w/api.php?action=query&format=json&meta=userinfo&uiprop=blockinfo
category.py
[root@mustang pywikipedia]# python category.py listify
Reading dump from category.dump.bz2
Please enter the name of the category to listify: Bot_Tests
Please enter the name of the list to create: test
Getting [[Category:Bot Tests]]...
Error downloading data: No JSON object could be decoded
Request
en:/w/api.php?action=query&format=json&meta=userinfo&uiprop=blockinfo
I did some searching and found references to a PHP file named JSON.php that
I do not have on my system.
I found several other postings with the same error message, but no
resolutions.
As always, any help would be much appreciated.
---Robert
I am installing pywikipedia. I have gotten to the point where I can run
python login.py and get prompted for a password. Then I get this:
[root@mustang pywikipedia]# !python
python login.py
Password for user wikibot on mustang:en:
Logging in to mustang:en as wikibot
Traceback (most recent call last):
File "login.py", line 376, in <module>
main()
File "login.py", line 372, in main
loginMan.login()
File "login.py", line 261, in login
cookiedata = self.getCookie(api)
File "login.py", line 178, in getCookie
response, data = self.site.postData(address,
self.site.urlEncode(predata))
File "/home/rwright/pywikipedia/wikipedia.py", line 4945, in postData
conn.endheaders()
File "/usr/lib/python2.6/httplib.py", line 868, in endheaders
self._send_output()
File "/usr/lib/python2.6/httplib.py", line 740, in _send_output
self.send(msg)
File "/usr/lib/python2.6/httplib.py", line 699, in send
self.connect()
File "/usr/lib/python2.6/httplib.py", line 683, in connect
self.timeout)
File "/usr/lib/python2.6/socket.py", line 498, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
socket.gaierror: [Errno -2] Name or service not known
[root@mustang pywikipedia]#
I tried the only solution on the archive I could find
Hello Mary,
the self.langs should contain the hostname 'localhost'. The path for the
wiki should be given in scriptpath. In your case, try something like
self.langs = {'en': 'localhost'}
def scriptpath(self, code):
return '/default'
Hopefully that should work!
Best reagards,
Merlijn
This did not work.
Any help would be much appreciated.
---Robert
Hi everyone. When trying to use a version of replace.py I get this error:
Traceback (most recent call last):
File "pande_replace.py", line 742, in <module>
main()
File "pande_replace.py", line 725, in main
gen = genFactory.getCombinedGenerator(gen)
TypeError: getCombinedGenerator() takes exactly 1 argument (2 given)
Exception exceptions.TypeError: "'NoneType' object is not callable" in
<bound method SharedSocket.__del__ of <httplib.SharedSocket instance at
0x1a45200>> ignored
Line 725 is:
query = u"""
SELECT page_namespace, page_title
FROM page
JOIN text ON (page_id = old_id)
%s
%s
LIMIT 200""" % (whereClause, exceptClause)
gen = pagegenerators.MySQLPageGenerator(query)
elif PageTitles:
pages = [pywikibot.Page(pywikibot.getSite(), PageTitle)
for PageTitle in PageTitles]
gen = iter(pages)
gen = genFactory.getCombinedGenerator(gen)
running parameters for script are:
python pande_replace.py -fix:comunes -start:! -always
I'm using latest revision from SVN.
Any ideas?
Umm, maxlag _is_ used, in pywikibot/data/api.py, lines 159-160:
if "maxlag" not in self.params and config.maxlag:
self.params["maxlag"] = [str(config.maxlag)]
Using the commandline argument -maxlag:0 will disable lagging.
Russ
----- Original Message -----
From: <nicdumz(a)svn.wikimedia.org>
To: <pywikipedia-svn(a)lists.wikimedia.org>
Sent: Thursday, September 17, 2009 9:39 AM
Subject: [Pywikipedia-svn] SVN: [7261] branches/rewrite/pywikibot
> Revision: 7261
> Author: nicdumz
> Date: 2009-09-17 13:39:38 +0000 (Thu, 17 Sep 2009)
>
> Log Message:
> -----------
> add config.no_lagging to disable lag for debugging purpose.
> (this should possibly be merged with maxlag which is currently not used)
>
> Modified Paths:
> --------------
> branches/rewrite/pywikibot/config2.py
> branches/rewrite/pywikibot/data/api.py
>
> Modified: branches/rewrite/pywikibot/config2.py
> ===================================================================
> --- branches/rewrite/pywikibot/config2.py 2009-09-17 12:00:47 UTC (rev
> 7260)
> +++ branches/rewrite/pywikibot/config2.py 2009-09-17 13:39:38 UTC (rev
> 7261)
> @@ -346,6 +346,11 @@
> # running solve_disambiguation.py with the -primary argument.
> special_page_limit = 500
>
> +# Disable lagging, for debugging purposes.
> +# If your bot has this variable activated in a production environment, it
> is
> +# likely to be too aggressive and to get blocked by system admins.
> +no_lagging = False
> +
> ############## TABLE CONVERSION BOT SETTINGS ##############
>
> # will split long paragraphs for better reading the source.
>
> Modified: branches/rewrite/pywikibot/data/api.py
> ===================================================================
> --- branches/rewrite/pywikibot/data/api.py 2009-09-17 12:00:47 UTC (rev
> 7260)
> +++ branches/rewrite/pywikibot/data/api.py 2009-09-17 13:39:38 UTC (rev
> 7261)
> @@ -281,7 +281,7 @@
> info = result["error"].pop("info", None)
> if code == "maxlag":
> lag = lagpattern.search(info)
> - if lag:
> + if lag and not config.no_lagging:
> pywikibot.output(
> u"Pausing due to database lag: " + info,
> level=pywikibot.VERBOSE)
>
>
>
> _______________________________________________
> Pywikipedia-svn mailing list
> Pywikipedia-svn(a)lists.wikimedia.org
> https://lists.wikimedia.org/mailman/listinfo/pywikipedia-svn
>
2009/8/27 <filnik(a)svn.wikimedia.org>:
> Revision: 7181
> Author: filnik
> Date: 2009-08-27 12:47:00 +0000 (Thu, 27 Aug 2009)
>
> Log Message:
> -----------
> Adding new feature: on it.wikipedia the template used is now only one for all the protection. I maintain the old settings for backward compatibily and because the old templates are still used (but deprecated)
Filnik, that changeset is too thick for me to understand it. Really.
I just know that it apparently breaks, at least on fr, with those settings.
File "/home/nicdumz/pywikipedia/blockpageschecker.py", line 308, in main
replaceToPerform = u'|'.join(TTP + TSP + TU)
TypeError: can only concatenate list (not "NoneType") to list
Can you look into it?
--
Nicolas Dumazet — NicDumZ
That because "ec" mean "edit/create", I change it when I add page create protect into wikipedia.py:Page().protect().I don't want to use more parameter to setup it so I use "edit" params.(for normal, you cannot use create protect if the page exist.)
But look that not easy to understand so maybe we can use other name, like "editcreate".
(
※ 引述《"Marcin Cieslak" <saper(a)saper.info>》之郵件內容:
>Dnia 04.09.2009 Russell Blau <russblau(a)imapmail.org> napisał/a:
>> Why do you want to change "edit" to "ec" when the MediaWiki software uses
>> "edit" for this protection level?
>
>This is probably to fix
>
>https://sourceforge.net/tracker/?func=detail&atid=603138&aid=2849998&group_…
>
>but I think it would be better to revert part of rev7195 that changes "edit" to "ec".
>
>--Marcin
>
>
>_______________________________________________
>Pywikipedia-l mailing list
>Pywikipedia-l(a)lists.wikimedia.org
>https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l
>
On Sun, Aug 23, 2009 at 6:13 PM, <multichill(a)svn.wikimedia.org> wrote:
> Revision: 7169
> Author: multichill
> Date: 2009-08-23 16:13:23 +0000 (Sun, 23 Aug 2009)
>
> Log Message:
> -----------
> First version of flickrripper.
> It works, but I still have to do a lot to get a nice program.
>
> Added Paths:
> -----------
> trunk/pywikipedia/flickrripper.py
>
> +import flickrapi
It seems you forgot to include that one as well - or should it be
downloaded from elsewhere?
--
André Engels, andreengels(a)gmail.com