Reputation:
I have written a script for Wikipedia & it works fine on my computer, yet when I upload it to my web host(Dreamhost) it doesn't work & says that the user I am trying to log in as is blocked-this is not true, it works on my computer & I#m not blocked. This is the exact error message I get-
A problem occurred in a Python script. Here is the sequence of function calls leading up to the error, in the order they occurred.
/home/tris1601/thewikipediaforum.com/pywikipedia/wikitest.py
35 site = wikipedia.getSite()
36 newpage = wikipedia.Page(site, u"User:Dottydotdot/test")
37 newpage.put(text + "<br><br>'''Imported from [http://en.wikiquote.org '''Wikiquote'''] by [[User:DottyQuoteBot|'''DottyQuoteBot''']]", u"Testing")
38
39 wikipedia.stopme()
newpage = Page{[[User:Dottydotdot/test]]}, newpage.put = <bound method Page.put of Page{[[User:Dottydotdot/test]]}>, text = u'You have so many things in the background that y... could possibly work?" <p> [[Ward Cunningham]] \n'
/home/tris1601/thewikipediaforum.com/pywikipedia/wikipedia.py in put(self=Page{[[User:Dottydotdot/test]]}, newtext=u"You have so many things in the background that y...''] by [[User:DottyQuoteBot|'''DottyQuoteBot''']]", comment=u'Testing', watchArticle=None, minorEdit=True, force=False, sysop=False, botflag=True)
1380
1381 # Check blocks
1382 self.site().checkBlocks(sysop = sysop)
1383
1384 # Determine if we are allowed to edit
self = Page{[[User:Dottydotdot/test]]}, self.site = <bound method Page.site of Page{[[User:Dottydotdot/test]]}>, ).checkBlocks undefined, sysop = False
/home/tris1601/thewikipediaforum.com/pywikipedia/wikipedia.py in checkBlocks(self=wikipedia:en, sysop=False)
4457 if self._isBlocked[index]:
4458 # User blocked
4459 raise UserBlocked('User is blocked in site %s' % self)
4460
4461 def isBlocked(self, sysop = False):
global UserBlocked = <class wikipedia.UserBlocked>, self = wikipedia:en
UserBlocked: User is blocked in site wikipedia:en
args = ('User is blocked in site wikipedia:en',)
Any ideas as to why it isn't working?
Thanks, much appreciated!
Upvotes: 0
Views: 508
Reputation: 37518
I'd start by adding in some debug. Can you capture the output you're sending to wikipedia and the results it resturns? There's probably some more information lodged in there which you can extract to see why it's failing.
[Edit] r.e. debugging - it's hard to give advice given the small snippet you provided. The fact that you've got over 3.5k lines in a single file suggests there's either some rather innefficient coding in there or that the problem wasn't particularly well broken down... which is likely to make debugging more tricky.
Having said that, the .put() mentioned in the debug above is almost certainly sending a request to the server. You could start by printing out those requests or bits of the request. To try and piece together what request is being sent and then try doing just those requests and recording the output using python's print command:
print "Sending '%s' to server%(my_put_request)
...where my_put_request is the bits of data you're sending.
[Edit2] I just spotted that this it's the pywikipedia bot script you're using. The wikipedia article on the bot mentions some points on permissions which would support uggedals suggestion of it being an access problem. It's quite possible that wikipedia recognises dreamhosts IP and that someone else has tried doing something bad in the past which has caused them to be blocked in some way.
Upvotes: 0
Reputation: 101
It could be that your host (Dreamhost) is blocked, and not your user.
Upvotes: 1