Community Central

Admin Forum:Suppressing numbering of output with pywikipediabot

18,828pages on
this wiki
Add New Page
Add New Page Talk0

This Forum has been archived

Forums: Admin Central Index Technical Help Suppressing numbering of output with pywikipediabot
Wikia's forums are a place for the community to help other members.
To contact staff directly or to report bugs, please use Special:Contact.

When trying to use the script in the latest version of pywikipediabot, I note that the output is now numbered, as seen in this snippet:

 68: Untitled (DWM 184)
 69: The Useful Pile (short story)
 70: Useless Things (short story)
 71: A Victorian Interlude (short story)
 72: A Visit to the Cinema (short story)

This wasn't the case in previous iterations of the script, so I'm unfamiliar with how to turn this unhelpful feature off. In order to manipulate the output, I can't think of a single instance in which you'd actually want to have these numbers present. Anyone out there know how to get rid of numbering? czechout@fandom    fly tardis 01:39: Mon 17 Sep 2012

Never mind. I poked around in the code and figured out how to disable it. czechout@fandom    fly tardis 20:37: Mon 17 Sep 2012
By the way, just in case anyone else wants to generate un-numbered output, here's the fix.
  1. Navigate to your pywikipedia folder. For Mac users who chose a standard installation of pywikipedia, this is found in Startup drive -> Users -> Yourusername — that is the same folder that contains Pictures, Documents, Desktop, Movies and the other "meta" folders of the current instance of OS X. Some people call this your home folder, and indeed the standard OS X icon for it is a little house. (Windows users, you're well-noticed in the Pywikipediabot Manual, so you don't need my help finding your pywikipedia folder.)
  2. Make a backup copy of, so that you've got a fallback in case you really screw up with the remainder of the instructions.
  3. Open in whatever program will let you edit it. Ideally, you should use a code editing program, as opposed to just a text editor. So something like Coda or XCode or Espresso or <insert your favourite Windows program here>.
  4. Enable line numbers if they aren't already visible.
  5. Go to line 1268 — or, if that flummoxes you, search for the following string: pywikibot.output("%4d
  6. Change from
    pywikibot.output("%4d: %s" % (i, page.title()), toStdout = True)
    pywikibot.output("%s" % (page.title()), toStdout = True)
    and save the changed result back to your pywikipedia folder.
When you complete these six easy steps, all output from will now be in a neat, un-numbered list. This changed format will mean that you can use the list directly in other pywikipedia</doc> scripts, or use them as a time-saving base for creating altered lists for yet other scripts. czechout@fandom    fly tardis 18:57: Mon 24 Sep 2012

Also on Fandom

Random Wiki