Admin Forum:Trouble with pywikipediabot

I've been using my bot YodaBot on both the PathfinderWiki and Oscars Wiki for several years. Recently, however, I got a new computer and just set up the bot on the new machine. I've followed the instructions in this extremely helpful blog post and managed to get everything set up (I think). It lets me log in and a "login.py -test" command line confirms that. But when I try to edit, I get errors that I don't have a token and won't be able to edit pages. Can anyone offer any assistance in this? Without the ability to use the bot, categorizing images is going to make for some really, really tedious editing in the future. — yoda8myhead (talk) 08:21, December 12, 2012 (UTC)


 * Try setting it back up from scratch if you haven't already. Do you have the most up-to-date version of Python installed? (2.7.3) --Callofduty4 (talk) 09:27, December 12, 2012 (UTC)


 * Could you provide a few more details, please?
 * OS (and version number)
 * Python version number
 * Pywikipedia version number
 * Whether you have access to the known working pywikipedia folder on your old computer
 * Whether you're sure you're using the right family.py file for the wiki you're trying to edit
 * Whether you're absolutely sure that your account is bot-flagged on the wiki you're trying to edit


 * Having recently upgraded my own computer recently, I'd say that your initial approach would be to just copy your old, working pywikipedia folder over to your new computer, change its permissions (depending on OS) so that the current account can access the files within that folder, and there ya go.


 * But, as I said, I don't really know enough details about your situation to really diagnose. 19:16: Wed 12 Dec 2012
 * Okay, I can see that you're a flagged bot on both oscars and pathfinder, but I can also see that it's been at least a year since you've made any edits with that account — on pathfinder, it's been almost three years. If you're trying to use the same package of files that you used back in the day, you'll probably have some difficulties.


 * The thing I'm thinking now is just that your family files aren't right. How 'bout posting them in their entirety, as well as user-config.py, and maybe I can spot the issue for you. 19:26: Wed 12 Dec 2012
 * Oh, another thing: it would be helpful to know exactly what you were trying to do when you got the error message.  Could you cut and paste the command you were trying to give?  Also, please put this into your command line.  It'll harmlessly test whether things are generally working or not.  Log into oscars and then type python pagegenerators.py -cat:"2010 nominated films" That should just generate a list of the movies in the category, and thereby prove that the error is in whatever command you issued, not your general setup.  If that instance of pagegenerators produces an error of any kind, please post that error back here.  19:34: Wed 12 Dec 2012


 * Thanks. I'll try all those when I get home tonight. —yoda8myhead (talk) 19:38, December 12, 2012 (UTC)


 * Oh, I should also point out that it's entirely possible you've simply been unlucky. I've not been running my bot while I've been posting to you, so I'm not aware of any problems with the api.  But there are times where you'll get that "invalid token" error purely because of some sort of behind-the-scenes connectivity issue at Wikia itself.  There've been plenty of times I've been in a big bot run and had the thing start throwing me tons of those "invalid token" errors.  They just keep coming until they eventually stop, and there's not a thing you can do about it.   19:44: Wed 12 Dec 2012


 * Ok, so I tested the command line you provided above and it worked perfectly. I'm still getting an error when entering the following, however:
 * python category.py add -file:nuke.txt
 * I'm on a Mac running OSX 10.8.2, Python 2.7, pywikipedia nightly build 2012-12-10
 * Let me know if you need to see my user-config and family files, and thanks for the help. —yoda8myhead (talk) 08:08, December 13, 2012 (UTC)
 * Okay so you're using the Python that came pre-installed with Mountain Lion, it sounds like. That's what I'm using, too, so we can probably rule out Python, and there's unlikely an error with the category.py code if you're dealing with a build from this week.  Not impossible just unlikely.  My next test would be to run python category.py add -cat:"2010 nominated films" That should bring up a prompt asking you what category you want to add.  Choose a silly name like TestyTestyMcTest and enter that.  The bot should then start to work, giving you the option of whether to put it on the first page in that category.


 * If it doesn't work, then we've got a bigger problem, and you may want to re-download just the category.py code, or I can just cut and paste a working version here, if you'd like.
 * If it does work, and mu suspicion is that it will, then the problem is almost certainly in your nuke.txt file. I've just tested creating a file of that name and using it with category.py and had no issue.  But here's the checklist of things to look at.  Each page name must be enclosed in brackets.  So, I dunno, Gandhi[Tootsie]]Casino RoyaleThe Return of the KingKung-Fu PandaOceans 13 In my experience, it's best if it's UTF-8, absolutely-brain-dead-stupid plain text.  So put your text into TextEdit and press SHIFT-CMND-T (or go under format and pull down to "make plain text").  Then, for simplicity sake, save the text file directly into your pywikipedia folder. That should work, as I've just precisely followed those instructions myself.


 * The other thing I'd say is that files with category.py aren't really necessary. By the time you've created a file that you could use with the -file:filename nomenclature, you could have just run the category.py bot by choosing to approve each page manually.  I'm obviously not sure exactly what you're trying to do, but if you can get the test I suggested above to work, consider running the bot like that.  It's almost certainly a lot faster to go manual than to create a text file and then run from the text file.  15:06: Thu 13 Dec 2012