Santiago M. Mola | 1 Nov 01:43 2009
Picon

CategorizedPageGenerator doesn't remember seen categories

Hi,

CategorizedPageGenerator doesn't seem to remember which categories it
already saw. That makes it innecessarily repeating categories and
recursing to the "infinite".

It'd be great if it didn't repeat categories.

Regards,
--

-- 
Santiago M. Mola
Jabber ID: cooldwind <at> gmail.com
Santiago M. Mola | 1 Nov 12:50 2009
Picon

Problems when output isn't a terminal

Hi,

It seems there's a problem with userinterface_terminal.py, which gives
problems when stdout is not a terminal but, for example, a pipe.

Example:

$ python pagegenerators.py -catr:Informática
Getting [[Categoría:Informática]]...
[...and a lot of results as excepcted...]

$ python pagegenerators.py -catr:Informática | grep Getting
Getting [[Categoría:Informática]]...
$

The program terminates very early, without going into recursion or
getting any page.

Regards,
--

-- 
Santiago M. Mola
Jabber ID: cooldwind <at> gmail.com

_______________________________________________
Pywikipedia-l mailing list
Pywikipedia-l <at> lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l
Marcin Cieslak | 4 Nov 10:13 2009

Re: Problems when output isn't a terminal

Dnia 01.11.2009 Santiago M. Mola <cooldwind <at> gmail.com> napisał/a:
> Hi,
>
> It seems there's a problem with userinterface_terminal.py, which gives
> problems when stdout is not a terminal but, for example, a pipe.

Did you mean userinterfaces/terminal_interface.py ?

The interface is what it says - it assumes an interactive UNIX tty
as the communication method with the user. 

I think there could be another interface implemented (for example
batch_interface.py for bots running from cron(8)) that handles
non-interactive environments. For example, by raising an Exception
whenever a question to the user is presented or
taking decision from some kind of decision file. 

--

-- 
              << Marcin Cieslak // saper <at> saper.info >>

_______________________________________________
Pywikipedia-l mailing list
Pywikipedia-l <at> lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l
Santiago M. Mola | 4 Nov 15:49 2009
Picon

Re: Problems when output isn't a terminal

On Wed, Nov 4, 2009 at 10:13 AM, Marcin Cieslak <saper <at> saper.info> wrote:
> Dnia 01.11.2009 Santiago M. Mola <cooldwind <at> gmail.com> napisał/a:
>> Hi,
>>
>> It seems there's a problem with userinterface_terminal.py, which gives
>> problems when stdout is not a terminal but, for example, a pipe.
>
> Did you mean userinterfaces/terminal_interface.py ?

Yes. Sorry, I meant that.

> The interface is what it says - it assumes an interactive UNIX tty
> as the communication method with the user.
>
> I think there could be another interface implemented (for example
> batch_interface.py for bots running from cron(8)) that handles
> non-interactive environments. For example, by raising an Exception
> whenever a question to the user is presented or
> taking decision from some kind of decision file.
>

That would be fine.

Another option would be to add a --batch option to express that there
won't be interaction with the user. With that option enabled, the bot
should fail if any of its mandatory values are not defined, and output
should work when output is a pipe or a file.

I suspect that this option might involve less code, unless a
text_interface.py (probably not the best name) is created and
(Continue reading)

Russell Blau | 5 Nov 19:11 2009

Re: [Pywikipedia-svn] SVN: [7596] trunk/pywikipedia

----- Original Message ----- 
From: <alexsh <at> svn.wikimedia.org>
To: <pywikipedia-svn <at> lists.wikimedia.org>
Sent: Thursday, November 05, 2009 1:09 PM
Subject: [Pywikipedia-svn] SVN: [7596] trunk/pywikipedia

> Revision: 7596
> Author:   alexsh
> Date:     2009-11-05 18:09:30 +0000 (Thu, 05 Nov 2009)
>
> Log Message:
> -----------
> add ignore .pyo

This seems to make a *lot* of changes that aren't described in the Log 
Message!
Dies Irae | 9 Nov 10:00 2009
Picon

interwiki.py summary translations

Hello. Could someone, who has access to pywikipedia files instert to interwiki.py bot summary translations for some new languages? I have made requests for various wikipedia users, and they gave me translations. Some requests still pending.

See the list of translations there: http://lt.wikipedia.org/wiki/Naudotojas:Hugo.arg/Vertimai

Regards, User:Hugo.arg

_______________________________________________
Pywikipedia-l mailing list
Pywikipedia-l <at> lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l
Gilles Deacur | 10 Nov 22:27 2009
Picon

Configuration Problems

I posted this yesterday about 15 hours ago and don't see it yet, so I'm reposting:



I'm new to anything Python related.  I downloaded pywikimedia yesterday and am trying to get this to work.

This is my dump from api.php?action=query&meta=siteinfo&siprop=general|namespaces|namespacealiases|statistics

[QUOTE]

<?xml version="1.0"?>
<api>
  <query>
    <general mainpage="Main Page" base="http://www.locksmithwiki.com/lockwiki/index.php/Main_Page" sitename="Locksmith Wiki Knowledge Base" generator="MediaWiki 1.15.1" case="first-letter" rights="" lang="en" fallback8bitEncoding="windows-1252" writeapi="" timezone="UTC" timeoffset="0" />
    <namespaces>
      <ns id="-2" canonical="Media" xml:space="preserve">Media</ns>
      <ns id="-1" canonical="Special" xml:space="preserve">Special</ns>
      <ns id="0" xml:space="preserve" />
      <ns id="1" subpages="" canonical="Talk" xml:space="preserve">Talk</ns>
      <ns id="2" subpages="" canonical="User" xml:space="preserve">User</ns>
      <ns id="3" subpages="" canonical="User talk" xml:space="preserve">User talk</ns>
      <ns id="4" canonical="Project" xml:space="preserve">Locksmith Wiki Knowledge Base</ns>
      <ns id="5" subpages="" canonical="Project talk" xml:space="preserve">Locksmith Wiki Knowledge Base talk</ns>
      <ns id="6" canonical="File" xml:space="preserve">File</ns>
      <ns id="7" subpages="" canonical="File talk" xml:space="preserve">File talk</ns>
      <ns id="8" canonical="MediaWiki" xml:space="preserve">MediaWiki</ns>
      <ns id="9" subpages="" canonical="MediaWiki talk" xml:space="preserve">MediaWiki talk</ns>
      <ns id="10" canonical="Template" xml:space="preserve">Template</ns>
      <ns id="11" subpages="" canonical="Template talk" xml:space="preserve">Template talk</ns>
      <ns id="12" canonical="Help" xml:space="preserve">Help</ns>
      <ns id="13" subpages="" canonical="Help talk" xml:space="preserve">Help talk</ns>
      <ns id="14" canonical="Category" xml:space="preserve">Category</ns>
      <ns id="15" subpages="" canonical="Category talk" xml:space="preserve">Category talk</ns>
    </namespaces>
    <namespacealiases>
      <ns id="6" xml:space="preserve">Image</ns>
      <ns id="7" xml:space="preserve">Image talk</ns>
    </namespacealiases>
    <statistics pages="8930" articles="3406" views="87415" edits="15885" images="760" users="264" activeusers="1" admins="2" jobs="0" />
  </query>
</api>

[/QUOTE]

This is my current "lockwiki_family.py" file (I removed the commented out lines):

[QUOTE]

# -*- coding: utf-8  -*-              # REQUIRED
import config, family, urllib         # REQUIRED

class Family(family.Family):          # REQUIRED
    def __init__(self):               # REQUIRED
        family.Family.__init__(self)  # REQUIRED
        self.name = 'Locksmith Wiki Knowledge Base'        # REQUIRED; replace with actual name

        self.langs = {                # REQUIRED
            'en': 'www.locksmithwiki.com',  # Include one line for each wiki in family
        }

        self.namespaces[4] = {
            '_default': [u'Locksmith Wiki Knowledge Base', self.namespaces[4]['_default']], # REQUIRED
        }

    self.namespaces[-2] = { 'en': 'Media' }
    self.namespaces[-1] = { 'en': 'Special' }
    self.namespaces[1] = { 'en': 'Talk' }
    self.namespaces[2] = { 'en': 'User' }
    self.namespaces[3] = { 'en': 'User talk' }
    self.namespaces[4] = { 'en': 'Locksmith Wiki Knowledge Base' }
    self.namespaces[5] = { 'en': 'Locksmith Wiki Knowledge Base talk' }
    self.namespaces[6] = { 'en': 'File' }
    self.namespaces[7] = { 'en': 'File talk' }
    self.namespaces[8] = { 'en': 'MediaWiki' }
    self.namespaces[9] = { 'en': 'MediaWiki talk' }
    self.namespaces[10] = { 'en': 'Template' }
    self.namespaces[11] = { 'en': 'Template talk' }
    self.namespaces[12] = { 'en': 'Help' }
    self.namespaces[13] = { 'en': 'Help talk' }
    self.namespaces[14] = { 'en': 'Category' }
    self.namespaces[15] = { 'en': 'Category talk' }

        self.content_id = "bodyContent"

        self.interwiki_text_separator = '\r\n\r\n'

        self.interwiki_putfirst = {}

        self.interwiki_putfirst_doubled = {}

        self.interwiki_forward = None

        self.obsolete = {}

        self.category_attop = []

        self.category_on_one_line = []

        self.category_text_separator = '\r\n\r\n'

        self.categories_last = []

    def protocol(self, code):
        """
        Can be overridden to return 'https'. Other protocols are not supported.
        """
        return 'http'

    def scriptpath(self, code):
        """The prefix used to locate scripts on this wiki.

        This is the value displayed when you enter {{SCRIPTPATH}} on a
        wiki page (often displayed at [[Help:Variables]] if the wiki has
        copied the master help page correctly).

        The default value is the one used on Wikimedia Foundation wikis,
        but needs to be overridden in the family file for any wiki that
        uses a different value.

        """
        return '/lockwiki'

    def apipath(self, code):
        return '%s/api.php' % self.scriptpath(code)

    def version(self, code):
        # Replace with the actual version being run on your wiki
        return '1.15.1'

    def code2encoding(self, code):
        """Return the encoding for a specific language wiki"""
        return 'utf-8'

[/QUOTE]

When I go to login.py the screen flashes and closes within a second.

I did have

        self.name = 'Locksmith Wiki Knowledge Base'        # REQUIRED; replace with actual name
and
            self.namespaces[4] = {
            '_default': [u'Locksmith Wiki Knowledge Base', self.namespaces[4]['_default']], # REQUIRED
        }

set as

        self.name = 'lockwiki'        # REQUIRED; replace with actual name
and
            self.namespaces[4] = {
            '_default': [u'lockwiki', self.namespaces[4]['_default']], # REQUIRED
        }

and that let me at least enter my password, but the screen closed so quickly I couldn't read the several lines of type that flashed up shortly afterwards.


What am I doing wrong here?




_______________________________________________
Pywikipedia-l mailing list
Pywikipedia-l <at> lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l
Marcin Cieslak | 12 Nov 05:04 2009

Re: Configuration Problems

Dnia 10.11.2009 Gilles Deacur <tronno22556 <at> gmail.com> napisał/a:
> I posted this yesterday about 15 hours ago and don't see it yet, so I'm

Here is the file that almost works for me:

---->8------ CUT HERE -----
# -*- coding: utf-8  -*-

__version__ = '$Id$'

import family

# The locksmithwiki family

class Family(family.Family):
    def __init__(self):
        family.Family.__init__(self)
        self.name = 'lockwiki'
        self.langs = {
            'en': 'www.locksmithwiki.com',
        }
        self.namespaces[4] = {
            '_default': [u'Locksmith Wiki Knowledge Base',
		self.namespaces[4]['_default']], # REQUIRED
        }
        self.namespaces[4] = {
            '_default': [u'Locksmith Wiki Knowledge Base talk',
		self.namespaces[5]['_default']], # REQUIRED
        }

    def scriptpath(self, code):
        return '/lockwiki'

    def version(self, code):
        return '1.15.1'

    def nicepath(self, code):
	return "%s/" % self.path(self, code)

---->8------ CUT HERE -----

While pasting above file please be extremely careful about spaces.

However, your API does no seem to work because every response
includes a Byte Order Mark. Please see:

http://www.mediawiki.org/wiki/Manual:Errors_and_Symptoms#Warning:_Cannot_modify_header_information_-_headers_already_sent_by_.28....29

You need to probably unpack your mediawiki files using some sane tool.

--Marcin

_______________________________________________
Pywikipedia-l mailing list
Pywikipedia-l <at> lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l
Gilles Deacur | 12 Nov 23:09 2009
Picon

Re: Configuration Problems

Thank you for the code.


I'm not sure exactly what response you got, but this is what login.py is shooting back at me:

[QUOTE]
Logging in to lockwiki:en as XXXXXX
Error downloading data: no JSON object could be decoded
Request en:/lockwiki/api.php?action=query&format=json&meta=userinfo&uiprop=block
info
Retrying
[/QUOTE]

I'm very unfamiliar with Byte Order Mark.  Is this actually the problem based on the screen output here?


On Wed, Nov 11, 2009 at 11:04 PM, Marcin Cieslak <saper <at> saper.info> wrote:
Dnia 10.11.2009 Gilles Deacur <tronno22556 <at> gmail.com> napisał/a:
> I posted this yesterday about 15 hours ago and don't see it yet, so I'm

Here is the file that almost works for me:

---->8------ CUT HERE -----
# -*- coding: utf-8  -*-

__version__ = '$Id$'

import family

# The locksmithwiki family

class Family(family.Family):
   def __init__(self):
       family.Family.__init__(self)
       self.name = 'lockwiki'
       self.langs = {
           'en': 'www.locksmithwiki.com',
       }
       self.namespaces[4] = {
           '_default': [u'Locksmith Wiki Knowledge Base',
               self.namespaces[4]['_default']], # REQUIRED
       }
       self.namespaces[4] = {
           '_default': [u'Locksmith Wiki Knowledge Base talk',
               self.namespaces[5]['_default']], # REQUIRED
       }

   def scriptpath(self, code):
       return '/lockwiki'

   def version(self, code):
       return '1.15.1'

   def nicepath(self, code):
       return "%s/" % self.path(self, code)

---->8------ CUT HERE -----

While pasting above file please be extremely careful about spaces.

However, your API does no seem to work because every response
includes a Byte Order Mark. Please see:

http://www.mediawiki.org/wiki/Manual:Errors_and_Symptoms#Warning:_Cannot_modify_header_information_-_headers_already_sent_by_.28....29

You need to probably unpack your mediawiki files using some sane tool.

--Marcin


_______________________________________________
Pywikipedia-l mailing list
Pywikipedia-l <at> lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l



--
Sunshine Locksmith Team -Tampa Bay Area Locksmiths
http://www.sunshinelocksmith.com


_______________________________________________
Pywikipedia-l mailing list
Pywikipedia-l <at> lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l
Marcin Cieslak | 13 Nov 11:21 2009

Re: Configuration Problems

Dnia 12.11.2009 Gilles Deacur <tronno22556 <at> gmail.com> napisał/a:
> I'm very unfamiliar with Byte Order Mark.  Is this actually the problem
> based on the screen output here?

Your api.php script returns strange output with the Byte Order Mark.
Please read further on Wikipedia or somewhere about what it is and 
why it is wrong to use that.

I don't think that your Mediawiki installation will work as expected.

You need to unpack MediaWiki files and not touch them with Windows
text editing tools like notepad or similar.

This is not a problem of your bot, it's the problem of your wiki.

Once this is fixed we can have a look further. 

--Marcin

_______________________________________________
Pywikipedia-l mailing list
Pywikipedia-l <at> lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l

Gmane