Manual talk:Pywikibot/Scripts

From MediaWiki.org
Jump to: navigation, search
<translate>

The following discussion has been transferred from [[<tvar|meta>meta:</>|Meta-Wiki]].</translate>
<translate>

Any user names refer to users of that site, who are not necessarily users of MediaWiki.org (even if they share the same username).</translate>

Hierarchy of script description pages[edit source]

Any objection to putting the script description pages under Pywikipediabot/Scripts/ instead of directly under Pywikipediabot/? I think it would be more intuitive, especially with the automatic breadcrumb trail ("< Pywikipediabot < Scripts"). —LarryGilbert 18:25, 8 January 2010 (UTC)

Hmm, I can see a certain logic behind doing it either way. Notice that on MediaWiki.org, we have mw:Manual:$wgTitle rather than mw:Manual:Globals/$wgTitle, but on the other hand we have mw:Manual:Hooks/ArticleSaveComplete rather than mw:Manual:ArticleSaveComplete. Because each script file ends in .py (much as the globals start with $), those pages' purpose is probably self-evident, and therefore we can leave them where they are. Tisane 21:54, 26 April 2010 (UTC)

What's the deal with the commented out stuff?[edit source]

Are those scripts that it would be inadvisable to use? Tisane 22:06, 8 April 2010 (UTC)

Uploadmultiple.py[edit source]

Shouldn't this script be taken off the page? It's not included in the framework as its page says. And anyway it's not working. --Plasmarelais 10:19, 3 April 2011 (UTC)

Moreover, Commonist is enough when we know the files names. JackPotte 10:23, 3 April 2011 (UTC)
I never seen that script. I removed it now. Xqt (talk) 17:30, 23 April 2012 (UTC)

Pageimport.py[edit source]

The documentation of this script isn't here, and doesn't work on Wikibooks:

This is a script to import pages from a certain wiki to another.

This requires administrator privileges.

Here there is an example of how to use it:

from pageimport import *
def main():
    # Defing what page to load..
    pagetoload = 'Apple'
    site = wikipedia.getSite()
    importerbot = Importer(site) # Inizializing
    importerbot.Import(pagetoload, prompt = True)
try:
    main()
finally:
    wikipedia.stopme()

When I try it to import an existing page from en.b to fr.b, this script (without project=) writes "success" but does nothing:

from wikipedia import *
from pageimport import *
def main():
    # Defing what page to load..
    pagetoload = 'en:Ict@innovation: Free your IT Business in Africa/fr/1'
    site = wikipedia.getSite(u'fr',u'wikibooks')
    importerbot = Importer(site) # Inizializing
    importerbot.Import(pagetoload, prompt = True)
try:
    main()
finally:
    wikipedia.stopme()

And this one (with project=) returns "failed":

from wikipedia import *
from pageimport import *
def main():
    # Defing what page to load..
    pagetoload = 'Ict@innovation: Free your IT Business in Africa/fr/1'
    site = wikipedia.getSite(u'fr',u'wikibooks')
    importerbot = Importer(site) # Inizializing
    importerbot.Import(pagetoload, prompt = True, project = u'en')
try:
    main()
finally:
    wikipedia.stopme()

JackPotte (talk) 14:16, 4 November 2012 (UTC)

Missing compat scripts[edit source]

ToDo list

  • blockreview
  • catimages
  • checkimages
  • create_categories
  • disambredir
  • imagecopy_self
  • interwiki_graph
  • ndashredir
  • nowcommons
  • overcat_simple_filter
  • pageimport
  • parserfunctioncount
  • patrol
  • spamremove
  • spellcheck
  • splitwarning
  • standardize_notes
  • subster
  • subster_irc
  • sum_disc
  • tag_nowcommons
  • unusedfiles

Hello world?[edit source]

Is there a "Hello world!" script?

I cooked one and it worked:

import pywikibot

site = pywikibot.Site()
page = pywikibot.Page(site, u"Sandbox")
text = page.text

page.text = u"Hello world!"
page.save(u"My bot's first edit!")

The above replaces the text of the page Sandbox with "Hello world!". Haribo (talk) 05:54, 2 September 2014 (UTC)