Manual talk:Pywikibot/add text.py

Add Text to pages in Special:WantedCategories
The header says it all... Is it possible to add a specific text to all pages in Special:WantedCategories? --91.33.247.68 21:23, 23 September 2009 (UTC) (Felix)
 * You can use the cat parameter, multiple times, e.g.
 * but I don't know any way to refer on Special:WantedCategories or on any special page. --Plasmarelais 17:37, 29 September 2009 (UTC)
 * but I don't know any way to refer on Special:WantedCategories or on any special page. --Plasmarelais 17:37, 29 September 2009 (UTC)

Bot doesn`t see the article
Hello!

I got some troubles while using this bot on my own wiki-site. It starts normally, gets the category. Then following message comes:

%pagename%, %path% - i put it here instead of real names. May be I should "turn on" global bots on my wiki somehow? I have mediawiki 1.15.1, python 2.6.2, pywikipedia 7282 installed. I`ll be glad to get any help, `cause this is first time I use pywikipedia bots. 93.89.211.151 13:36, 24 September 2009 (UTC)
 * Is your bot running with global bot rights or with local bot rights? --Plasmarelais 17:50, 29 September 2009 (UTC)
 * Plasmarelais, thank you for attention. I can`t tell you such info, just because I don`t know, how to check it. Could you explain more properly what file I can get such info from?
 * It seems I didn't find out, what is meant with global bot. You say it's your own wiki, is it a wikia-wiki? Maybe these 2 pages may help, but I don't know more about it: m:Talk:Bot policy/Implementation and Bot policy. Sorry --Plasmarelais 12:37, 5 October 2009 (UTC)
 * Thank you for trying to help. I`ve looked through these pages, but I still can`t understand, how do I turn these global bots on and do I realy need it to be done to solve my problem...--91.193.253.138 13:29, 5 October 2009 (UTC)
 * Updating to the 7492-version of pywikipedia fixes the problem.--91.193.253.138 21:52, 17 October 2009 (UTC)

Add text to empty pages
I've got a problem. I want to add a (long) text to ~150 pages. I've got a List of all these pages. Unfortunately it doesn't work.

Here is what I've tried so far (Do not punch me. The error logs prooves that I'm using windows -- and german...): C:\Users\damrau\Miniprogs\pywikipedia>python add_text.py -links:Spielwiese -text:"Test" Loading Benutzer Diskussion:-MM-... Benutzer Diskussion:-MM- doesn't exist, skip! Traceback (most recent call last): File "add_text.py", line 312, in    main File "add_text.py", line 308, in main (text, newtext, always) = add_text(page, addText, summary, regexSkip, regexS kipUrl, always, up, True) ValueError: need more than 2 values to unpack

Does anybody know how to solve this? I do not really understand the error message. --91.33.195.178 08:02, 5 October 2009 (UTC) (Felix)
 * Far as I know, add_text.py only works on existing pages. But you may use Pywikipediabot/pagefromfile.py to create those pages using a file that contains necessary information, which should easily be created from the list you already have. --Plasmarelais 08:13, 5 October 2009 (UTC)
 * Excuse my offtop. As I see, this problem is quite similar to the one I`ve got (see the previous topic). But in my situation I do have this pages on my wiki, but add_text.py doesn`t see them. Any idea about this? (Please, answer in previous topic).--91.193.253.138 11:15, 5 October 2009 (UTC)
 * There is a quite new version of this script. Did you download and replace this with the file in your pywikipedia directory? Maybe that will solve your problem --91.33.195.178 22:30, 5 October 2009 (UTC) (Felix)


 * There is an easy way to make add-text.py not skip non-existent pages. Simply edit the add_text.py file to change "create=talkPage" (sixth line from the bottom) to "create=True". 71.232.44.22 19:21, 24 May 2012 (UTC)

No documented parameters
The readme/docs for this script do not include or state the core parameters that can be used. Currently it only says: These command line parameters can be used to specify which pages to work on: &params; So my question is... what parameters? --Ccornell 09:08, 20 November 2009 (UTC)

&params will work nicely, when you type add_text.py -help. It takes help from pagegenerators.py. Bináristell me 11:58, 4 March 2011 (UTC)

Why is this page moved to mw?
What was the reason to move this page from Meta to MediaWiki, while all the similar pages about various scripts are on Meta? Bináristell me 12:00, 4 March 2011 (UTC)

Merged content
This section, without the section header and the italic comments was here on mw.org before the import of the above content from meta What was the reason to move this page from Meta to here, while all the similar pages about various scripts are on Meta? Bináris 11:55, 4 March 2011 (UTC)
 * I didn't find the consensus but suggest to build the JavaScript library at the same place. JackPotte 10:06, 5 March 2011 (UTC)

This stuff is not related to JavaScript, and now it is disconnected from other Pywikibot scripts. Bináris 21:18, 16 March 2011 (UTC)

End merged content The above thread refers to the import of the add_text.py documentation when most other pages had not been imported. Now all pywikipediabot documentation and talk pages have been imported. The reason for the move is that the pywikipediabot scripts are maintained in the wikimedia subversion repository and therefore documentation for them belongs here on mw.org--Doug.(talk • contribs) 21:17, 18 December 2011 (UTC)

Problems with large pages (> 600 kB)
Is it possible that this script doesn't work with large pages of e.g. more than 600 kB? I got a Python error when I tried to add some sections to, but with a similar page of about 350 kB it worked perfectly. I don't know if this is a known issue or if I have to file a bug. Regards --CroMagnon (talk) 22:42, 17 November 2012 (UTC)

Sections
How can I add text for a section? (by name, by the number of the section) Thanks, Dekel E (talk) 07:19, 3 January 2014 (UTC)

parameter except
Do I get it right, that whenever i give more than one parameter except, that the script only skips those pages that contain all of the given strings? Example: will add text on a page that contains abc but not xyz (and vice versa) but will skip a page that contains abc and xyz? --Plasmarelais (talk) 09:10, 12 August 2015 (UTC)

Solution: Using the pipe in the except parameter. will have the bot skip any page that contains Category or category or License or license or... --Plasmarelais (talk) 21:10, 29 August 2015 (UTC)

Allow to remove minor edit tag
Hello,

I use the script to add a section to a project page which is designed for technical logs (essentially added by bots). But, with this script, I currently can't remove the minor edit tag, which is fixed automatically. Could we add a parameter to  to allow the removal of this tag? — Automatik (talk) 16:39, 6 March 2016 (UTC)

[RESOLVED] PWB crashes with "Caught exception of type OOUI" with "add_text.py" on FORM pages
The command:  works great for all pages except those in the "Forms" namespace. For some reason all Form pages crash "add_text.py" as follows:  [me@myserver core_stable]$python3 pwb.py add_text -family:mywiki -lang:en -page:"Form:MyForm" -text:"Foo" Loading Form:MyForm...

>>> Form:MyForm <<< @@ -95,2 +94,0 @@ -

@@ -101 +99,5 @@ - + + Foo + +

Do you want to accept these changes? ([y]es, [N]o, [a]ll, open in [b]rowser, [q]uit): y

WARNING: API error internal_api_error_OOUI\Exception: [X6MLWZ2b5l25IGNg96uvrwAAAAU] Exception caught: OOUI\Theme::singleton was called with no singleton theme set. ERROR: Detected MediaWiki API exception internal_api_error_OOUI\Exception: [X6MLWZ2b5l25IGNg96uvrwAAAAU] Exception caught: OOUI\Theme::singleton was called with no singleton theme set. [errorclass: OOUI\Exception; *: OOUI\Exception at /opt/htdocs/mediawiki/vendor/oojs/oojs-ui/php/Theme.php(31) ERROR: page Form:MyForm not saved due to internal_api_error_OOUI\Exception: [X6MLWZ2b5l25IGNg96uvrwAAAAU] Exception caught: OOUI\Theme::singleton was called with no singleton theme set. [errorclass: OOUI\Exception; *: OOUI\Exception at /opt/htdocs/mediawiki/vendor/oojs/oojs-ui/php/Theme.php(31)
 * 1) 0 /opt/htdocs/mediawiki/vendor/oojs/oojs-ui/php/Element.php(241): OOUI\Theme::singleton
 * 2) 1 /opt/htdocs/mediawiki/extensions/PageForms/includes/forminputs/PF_DatePickerInput.php(108): OOUI\Element->toString
 * 3) 2 /opt/htdocs/mediawiki/extensions/PageForms/includes/PF_FormPrinter.php(1905): PFDatePickerInput->getHtmlText
 * 4) 3 /opt/htdocs/mediawiki/extensions/PageForms/includes/PF_FormPrinter.php(1295): PFFormPrinter->formFieldHTML(PFFormField, string)
 * 5) 4 /opt/htdocs/mediawiki/includes/StubObject.php(112): PFFormPrinter->formHTML(string, NULL, boolean, NULL, NULL, string, NULL)
 * 6) 5 /opt/htdocs/mediawiki/includes/StubObject.php(138): StubObject->_call(string, array)
 * 7) 6 /opt/htdocs/mediawiki/extensions/PageForms/includes/PF_Hooks.php(389): StubObject->__call(string, array)
 * 8) 7 /opt/htdocs/mediawiki/includes/Hooks.php(174): PFHooks::showFormPreview(EditPage, DerivativeRequest)
 * 9) 8 /opt/htdocs/mediawiki/includes/Hooks.php(202): Hooks::callHook(string, array, array, NULL)
 * 10) 9 /opt/htdocs/mediawiki/includes/EditPage.php(1117): Hooks::run(string, array)
 * 11) 10 /opt/htdocs/mediawiki/includes/api/ApiEditPage.php(386): EditPage->importFormData(DerivativeRequest)
 * 12) 11 /opt/htdocs/mediawiki/includes/api/ApiMain.php(1601): ApiEditPage->execute
 * 13) 12 /opt/htdocs/mediawiki/includes/api/ApiMain.php(537): ApiMain->executeAction
 * 14) 13 /opt/htdocs/mediawiki/includes/api/ApiMain.php(508): ApiMain->executeActionWithErrorHandling
 * 15) 14 /opt/htdocs/mediawiki/api.php(87): ApiMain->execute
 * 16) 15 {main}]; raising
 * 1) 0 /opt/htdocs/mediawiki/vendor/oojs/oojs-ui/php/Element.php(241): OOUI\Theme::singleton
 * 2) 1 /opt/htdocs/mediawiki/extensions/PageForms/includes/forminputs/PF_DatePickerInput.php(108): OOUI\Element->toString
 * 3) 2 /opt/htdocs/mediawiki/extensions/PageForms/includes/PF_FormPrinter.php(1905): PFDatePickerInput->getHtmlText
 * 4) 3 /opt/htdocs/mediawiki/extensions/PageForms/includes/PF_FormPrinter.php(1295): PFFormPrinter->formFieldHTML(PFFormField, string)
 * 5) 4 /opt/htdocs/mediawiki/includes/StubObject.php(112): PFFormPrinter->formHTML(string, NULL, boolean, NULL, NULL, string, NULL)
 * 6) 5 /opt/htdocs/mediawiki/includes/StubObject.php(138): StubObject->_call(string, array)
 * 7) 6 /opt/htdocs/mediawiki/extensions/PageForms/includes/PF_Hooks.php(389): StubObject->__call(string, array)
 * 8) 7 /opt/htdocs/mediawiki/includes/Hooks.php(174): PFHooks::showFormPreview(EditPage, DerivativeRequest)
 * 9) 8 /opt/htdocs/mediawiki/includes/Hooks.php(202): Hooks::callHook(string, array, array, NULL)
 * 10) 9 /opt/htdocs/mediawiki/includes/EditPage.php(1117): Hooks::run(string, array)
 * 11) 10 /opt/htdocs/mediawiki/includes/api/ApiEditPage.php(386): EditPage->importFormData(DerivativeRequest)
 * 12) 11 /opt/htdocs/mediawiki/includes/api/ApiMain.php(1601): ApiEditPage->execute
 * 13) 12 /opt/htdocs/mediawiki/includes/api/ApiMain.php(537): ApiMain->executeAction
 * 14) 13 /opt/htdocs/mediawiki/includes/api/ApiMain.php(508): ApiMain->executeActionWithErrorHandling
 * 15) 14 /opt/htdocs/mediawiki/api.php(87): ApiMain->execute
 * 16) 15 {main}]

[me@myserver core_stable]$ This error message does not produce any results when searched for.

Please advise.

Thanks!

/Rich Revansx (talk) 19:24, 4 November 2020 (UTC)

RESOLVED per https://gerrit.wikimedia.org/r/plugins/gitiles/mediawiki/extensions/PageForms/+/ed9394b7a4fa91ac93052817f18b28885e7312f6%5E%21/#F0

-except argument removed
Was removed in v 6.3.0 --Backlitt (talk) 17:26, 22 June 2021 (UTC)