Manual talk:Pywikipediabot/Archive 1

CVS diff
You recommend using "cvs diff". Surely you want to recommend "cvs diff -u"? This gives a much more robust diff format than the default (submitting patches in a format other than unidiff is a common newbie dev mistake). Subversion uses that format by default, and is nicer than CVS in lots of other ways, so you might want to move to that instead :) Hairy Dude 08:25, 7 March 2006 (UTC)
 * pywikipediabot is a framework for which most of the users have installed CVS tools, and these users are not using CVS for anything else. It is bad enough that we required normal users to use developers tools to use the programs, migrating to subversion will not happen any time soon! You are completely right that -u should be used to generate patches against cvs. Rob Hooft 12:01, 9 April 2006 (UTC)

CVS instructions
I think the CVS instructions need updating. They don't seem to work- did the CVS repository move to another address? --129.21.121.171 18:33, 16 May 2006 (UTC)


 * Ok, it seems to be working now. I guess the CVS server did move. --129.21.121.171 04:05, 23 May 2006 (UTC)

Unicode problem
I am writing a bot to run on Hindi Wikipedia. I am using python wikimedia framework. I am getting an error, "UnicodeDecodeError: 'utf8' codec can't decode byte 0xff in position 0: unexpected code byte" when executing the following code,

f = codecs.open('hi-towns.csv', 'r', config.textfile_encoding) x = f.read.decode('utf8')

Any help will be greatly appreciated. Thanks, Ganeshk 03:54, 16 July 2006 (UTC)
 * This was solved. - Ganeshk 15:15, 16 July 2006 (UTC)

Not updated?
TortoiseCVS does not seem to work with Pywikipedia, and the link http://sourceforge.net/cvs/?group_id=93107 seems to be dead. - Soulkeeper 19:12, 1 September 2006 (UTC)

python-xml
On another list it mentioned that the python-xml libraries were needed as well. With Fedora Linux I got that using 'yum install PyXML'. Other systems probably vary. 143.52.82.248 13:57, 1 November 2006 (UTC)

doc included in framework
I extracted the documentation included in wkipedia.py with this : import wikipedia import codecs

manuel = file("manuel.txt", "w") doc = wikipedia.__doc__

for ligne in doc: manuel.write(ligne)

Maybe one can include this somewhere ?

Library to get and put pages on a MediaWiki.

Contents of the library (objects and functions to be used outside, situation late August 2004)

Classes: Page: A MediaWiki page __init__             : Page(Site, Title) - the page with title Title on wikimedia site Site title                : The name of the page, in a form suitable for an interwiki link urlname              : The name of the page, in a form suitable for a URL titleWithoutNamespace : The name of the page, with the namespace part removed section              : The section of the page (the part of the name after '#') sectionFreeTitle     : The name without the section part aslink               : The name of the page in the form Title or lang:Title site                 : The wiki this page is in    encoding              : The encoding of the page isAutoTitle          : If the title is a well known, auto-translatable title autoFormat           : Returns (dictName, value), where value can be a year, date, etc., and dictName is 'YearBC', 'December', etc.   isCategory            : True if the page is a category, false otherwise isImage              : True if the page is an image, false otherwise

get (*)              : The text of the page exists (*)           : True if the page actually exists, false otherwise isRedirectPage (*)   : True if the page is a redirect, false otherwise isEmpty (*)          : True if the page has 4 characters or less content, not counting interwiki and category links interwiki (*)        : The interwiki links from the page (list of Pages) categories (*)       : The categories the page is in (list of Pages) linkedPages (*)      : The normal pages linked from the page (list of Pages) imagelinks (*)       : The pictures on the page (list of Pages) templates (*)        : All templates referenced on the page (list of strings) getRedirectTarget (*) : The page the page redirects to   isDisambig (*)        : True if the page is a disambiguation page getReferences        : List of pages linking to the page namespace            : The namespace in which the page is    permalink (*)         : The url of the permalink of the current version move                 : Move the page to another title

put(newtext)         : Saves the page delete               : Deletes the page (requires being logged in)

(*) : This loads the page if it has not been loaded before; permalink might even reload it if it has been loaded before

Site: a MediaWiki site messages             : There are new messages on the site forceLogin: Does not continue until the user has logged in to the site getUrl: Retrieve an URL from the site

Special pages: Dynamic pages: allpages: Special:Allpages newpages: Special:Newpages longpages: Special:Longpages shortpages: Special:Shortpages categories: Special:Categories

Cached pages: deadendpages: Special:Deadendpages ancientpages: Special:Ancientpages lonelypages: Special:Lonelypages uncategorizedcategories: Special:Uncategorizedcategories uncategorizedpages: Special:Uncategorizedpages unusedcategories: Special:Unusuedcategories

Other functions: getall: Load pages via Special:Export setAction(text): Use 'text' instead of "Wikipedia python library" in   editsummaries argHandler(text): Checks whether text is an argument defined on wikipedia.py   (these are -family, -lang, -log and others) translate(xx, dict): dict is a dictionary, giving text depending on language, xx is a language. Returns the text in the most applicable language for the xx: wiki

output(text): Prints the text 'text' in the encoding of the user's console. input(text): Asks input from the user, printing the text 'text' first. showDiff(oldtext, newtext): Prints the differences between oldtext and newtext on the screen

getLanguageLinks(text,xx): get all interlanguage links in wikicode text 'text' in the form xx:pagename removeLanguageLinks(text): gives the wiki-code 'text' without any interlanguage links. replaceLanguageLinks(oldtext, new): in the wiki-code 'oldtext' remove the language links and replace them by the language links in new, a dictionary with the languages as keys and either Pages or titles as values getCategoryLinks(text,xx): get all category links in text 'text' (links in the   form xx:pagename) removeCategoryLinks(text,xx): remove all category links in 'text' replaceCategoryLinks(oldtext,new): replace the category links in oldtext by   those in new (new a list of category Pages) stopme: Put this on a bot when it is not or not communicating with the Wiki any longer. It will remove the bot from the list of running processes, and thus not slow down other bot threads anymore.


 * I put it in wikipedia.py/doc.Hillgentleman 16:38, 17 November 2007 (UTC)

Error in article
(To work in Python25 http://www.python.org/download/, the files must be downloaded into the Python25 folder). I have installed Python25 and downloaded pywikipedia from cvs today, the pywikipedia files are on a different disk than the Python25 folder, and it works. I conclude that what this line claims is false. I am not 100% sure so I didn't edit it out myself. If anyone is 100% sure, please edit it out. Theroachman 23:47, 14 February 2007 (UTC)


 * I've always thought this was false because I think I have Python 2.5 on the other computer I used to run Pywikipediabot on. But I just verified. I installed Python 2.5 and altered my environment variable so that the system would use Python25 instead of Python24, and Pywikipediabot runs the exact same as it did with Python 2.4 so this line must be false. I really don't get why anyone would have added this line. It's more unproductive than productive, IMHO you should never go and put frameworks like Pywikipediabot into the core folder of the programs running them.
 * Also, for those who use TortiseCVS there is a bit of confusion with the CVSROOT for those who have never used it before, I'm going to tweak that to.
 * Also, I have a good tip for Windows users that makes putting the bot in your My Documents not a pain to cd into. Dantman 20:38, 14 July 2007 (UTC)

using special characters
I would like to use the template.py, but run into one problem.

template.py "Tableheader 100" "Tableheader|100%"

Notice the %-sign in the example, it gets lost. Any idea, how it could be included?

Ok, found it: %% --GunterS 13:05, 3 March 2007 (UTC)

Dry run
Does anyone know how to run a bot, record edits that it would have made, but not actually make the edtits? (also known as a Dry-run)
 * Within this framework, you have to edit the code in wikipedia.py under the Site class, under the postData method so that "con.send(data)" line prints data instead, you'll have to comment out the rest of that method as well. This may cause other problems but it's the best place (As far as I know) to start. 138.67.78.236

Which folder?
Save the text file as user-config.py, saving the text file in the folder with all of the other .py files you downloaded.

Which folder is this referring to? The main pywikipedia folder?


 * Yes. --.anaconda 22:09, 17 July 2007 (UTC)

how to find a developer
Under Contributing changes it states: send the file svn.diff to the developer

it doesnt state how.--Jan Friberg 16:41, 1 September 2007 (UTC)


 * I have updated the "Contributing changes" section to mention the sf.net bug tracking system. John Vandenberg 02:06, 6 September 2007 (UTC)

user-config.py
The instructions are a bit unclear about what parts are for other languages or other wikis. If I just want to edit wikipedia, shoud my user-config.py file just read: mylang = 'en' usernames['wikipedia']['en'] = u'mybotname' Because when I try that, it tells me "SyntaxError: unexpected character after line continuation character".

Various options
I think we need a bit more options described in the configuration section. There's a few options that were essential for getting the bot to work (e.g. adding 'Colorized_output = False') that are not described on the main page - and if there are other variables available, they should be listed. Of course, the necessity of that variable probably counts as a bug. --76.10.156.14 20:33, 18 November 2007 (UTC)

NewImages generator
how can I get recently uploaded pages via pywikipedia?

A Sub Project:Translate editSummary and update bot information for some scripts in Meta
(Sorry, my English is not very good)I am running some bot scripts in some languages WP now. (All statistics in here) But I found a lot of editSummary is not ready in scripts. I have to ask local communities (or they tell me the correct messages by themselves), find the better translate, and patch to Subversion by myself.I think we can make a sub project or translate request in here, and update the message by everybody --Alex S.H. Lin 17:11, 30 December 2007 (UTC)

Login problems
Hi all,

I'm making a few experimentations with the pywikipediabot but I'm facing a major problem; i was able to set up Python and the bot in itself, though when I want to launch login.py, it asks me my password and I can't type a thing. I tried on WP FR and EN but it didn't change a thing. Can anyone help me on that point? Many thanks. --Bombastus 10:23, 5 January 2008 (UTC)


 * Hi there ! When the bot asks you to enter your password, you can enter it on your keyboard, even if the letters don't appear on the screen. Once it's done, press Enter and the bot will tell you if it's logged in or not. -Urobore 06:32, 11 February 2008 (UTC)

Installing?
A quick question, maybe the answer is obvious, I am not to sure. To install the needed software (Python, Bot, etc...) is this installed on the users computer, or the server where the wiki is? I am still new to this sort of stuff. --CaptainBrooks 03:01, 16 March 2008 (UTC)
 * On the computer from where You run the bot, best regards, --birdy geimfyglið (:> )=  ∇  03:54, 16 March 2008 (UTC)

Non-interactive mode
I can only access my MediaWiki at my hoster through (s)ftp and thus installed a phpshell to have some shell functionality. Unfortunately this is not an interactive shell. Can I still use these bots in an non-interactive mode. I already fail at the login. I guess it asks for the password.

I am especially interested in using weblinkchecker.py and replace.py. But ideally I would like to be able to use all scripts.

Thanks! -- 217.236.174.233 22:06, 11 April 2008 (UTC)


 * LOL. Forget about my previous question. I figured the bots don't run on the server itself but on any client connected to the internet... that was a misunderstanding which isn't really made clear in the documentation. -- 217.236.143.111 12:07, 12 April 2008 (UTC)

'python' is not recognized
Attempted to run the script login.py by typing "python login.py":
 * 'python' is not recognized as an internal or external command, operable program or batch file.

Answer at: http://www.python.org/doc/faq/windows/

This problem is solved by using ActivePython instead. The instructions now suggest downloading ActivePython instead of Python. (Thanks alnokta)

Odessaukrain 21:11, 24 May 2008 (UTC)

user-config.py
In cmd.exe on the C:\pywikipedia line, when I type:


 * login.py

I get this message:

Please create a file user-config.py, and put in there:

One line saying "mylang='language'" One line saying "usernames ['wikipedia']['language']='yy'"

...filling in your username and the language code of the wiki you want to work on.

For other possible configuration variables check config.py.

Answer: Pywikipedia_bot_on_non-Wikimedia_projects

Odessaukrain 18:02, 24 May 2008 (UTC)

Question:
How can I set the language ("lang" in global arguments) to be all the languages for user config? --Firilacroco 14:55, 5 June 2008 (UTC)