Hello Mary,
the self.langs should contain the hostname 'localhost'. The path for the
wiki should be given in scriptpath. In your case, try something like
self.langs = {'en': 'localhost'}
def scriptpath(self, code):
return '/default'
Hopefully that should work!
Best reagards,
Merlijn
On Fri, June 19, 2009 9:56 pm, Beebe, Mary J wrote:
> I am not trying a simpler family setup file. I am putting None in for
> en:'None'. Then adding:
> def hostname(self,code):
> return '/default'
>
> Mary Beebe
>
> ________________________________
> From: pywikipedia-l-bounces(a)lists.wikimedia.org
> [mailto:pywikipedia-l-bounces@lists.wikimedia.org] On Behalf Of Beebe,
> Mary J
> Sent: Friday, June 19, 2009 3:22 PM
> To: pywikipedia-l(a)lists.wikimedia.org
> Subject: [Pywikipedia-l] Getting started
>
> I am trying to setup pywikipedia to work on my local wiki. I have tried
> to follow online steps plus steps within README-family.txt.
>
> My test wiki is: http://localhost/default (it is not live anywhere).
>
> It seems like I am having trouble with this line within default_family.py
> (my family file).
>
> self.langs = { # REQUIRED
> 'en': 'localhost/default', # Include one line for each wiki
> in family
> # in the format 'code': 'hostname',
> }
>
> I have tried many different possibilities but have been unsuccessful.
> Here is the message I receive with login.py:
>
> login.py
> Password for user PyWikipedialBot on default:en:
> Logging in to default:en as PyWikipedialBot
> Traceback (most recent call last):
> File "C:\Documents and Settings\beebem\Desktop\pywikipedia\login.py",
> line 316, in <module>
> main()
> File "C:\Documents and Settings\beebem\Desktop\pywikipedia\login.py",
> line 312, in main
> loginMan.login()
> File "C:\Documents and Settings\beebem\Desktop\pywikipedia\login.py",
> line 248, in login
> cookiedata = self.getCookie()
> File "C:\Documents and Settings\beebem\Desktop\pywikipedia\login.py",
> line 166, in getCookie
> response, data = self.site.postData(address,
> self.site.urlEncode(predata))
> File "C:\Documents and
> Settings\beebem\Desktop\pywikipedia\wikipedia.py", line 4655, in
> postData
> conn.endheaders()
> File "C:\Python26\lib\httplib.py", line 868, in endheaders
> self._send_output()
> File "C:\Python26\lib\httplib.py", line 740, in _send_output
> self.send(msg)
> File "C:\Python26\lib\httplib.py", line 699, in send
> self.connect()
> File "C:\Python26\lib\httplib.py", line 683, in connect
> self.timeout)
> File "C:\Python26\lib\socket.py", line 498, in create_connection
> for res in getaddrinfo(host, port, 0, SOCK_STREAM):
> socket.gaierror: [Errno 11001] getaddrinfo failed
>
> Thank you,
>
> Mary Beebe
>
>
> _______________________________________________
> Pywikipedia-l mailing list
> Pywikipedia-l(a)lists.wikimedia.org
> https://lists.wikimedia.org/mailman/listinfo/pywikipedia-l
>
Hello guys,
I have problem to login, my wiki is locate on localhost/wikiSimpop
Here my user-config.py : *
mylang = 'fr'
family = 'wikiSimpop'
usernames['wikiSimpop']['fr'] = u'abotsimpop'*
Here my family wikiSimpop_family.py :
*
# -*- coding: utf-8
-*-
import family
class Family(family.Family):
def __init__(self):
family.Family.__init__(self)
self.name = 'wikiSimpop'
self.langs = {
'fr':
'wikiSimpop',
}
self.namespaces[4] = {
'_default': [u'wikiSimpop', self.namespaces[4]['_default']],
'fr': u'wikiSimpop',
}
def scriptpath(self, code):
return '/wikiSimpop'*
*
And the probleme is : *
*
srey@ubuntu:~/STAGE2/RSYNC/DEV/SANDBOX/PYTHON/pywikipedia$ python login.py
-v -v -pass:postgres*
DBG> BUG: Non-unicode (<type 'str'>) passed to wikipedia.output without
decoder!
File "login.py", line 316, in <module>
main()
File "login.py", line 274, in main
for arg in wikipedia.handleArgs():
File
"/home/srey/STAGE2/RSYNC/DEV/SANDBOX/PYTHON/pywikipedia/wikipedia.py", line
6498, in handleArgs
output('Pywikipediabot %s' % (version.getversion()))
File
"/home/srey/STAGE2/RSYNC/DEV/SANDBOX/PYTHON/pywikipedia/wikipedia.py", line
6820, in output
print traceback.print_stack()
None
DBG> Attempting to recover, but please report this problem
Pywikipediabot nightly:pywikipedia (r6998, juin 25 2009, 14:41:11)
DBG> BUG: Non-unicode (<type 'str'>) passed to wikipedia.output without
decoder!
File "login.py", line 316, in <module>
main()
File "login.py", line 274, in main
for arg in wikipedia.handleArgs():
File
"/home/srey/STAGE2/RSYNC/DEV/SANDBOX/PYTHON/pywikipedia/wikipedia.py", line
6499, in handleArgs
output('Python %s' % (sys.version))
File
"/home/srey/STAGE2/RSYNC/DEV/SANDBOX/PYTHON/pywikipedia/wikipedia.py", line
6820, in output
print traceback.print_stack()
None
DBG> Attempting to recover, but please report this problem
Python 2.6.2 (release26-maint, Apr 19 2009, 01:58:18)
[GCC 4.3.3]
WARNING: Using -v -v on login.py might leak private data. When sharing,
please double check your password is not readable and log out your bots
session.
Logging in to wikiSimpop:fr as abotsimpop
self.site.postData(/w/index.php?title=Sp%C3%A9cial:Userlogin&useskin=monobook&action=submit,
wpSkipCookieCheck=1&wpPassword=XXXXX&wpDomain=&wpRemember=1&wpLoginattempt=Aanmelden%20%26%20Inschrijven&wpName=abotsimpop)
404/Not Found
Date: Fri, 26 Jun 2009 17:58:26 GMT
Server: Apache/2.2.11 (Ubuntu) PHP/5.2.6-3ubuntu4.1 with Suhosin-Patch
Vary: Accept-Encoding
Content-Encoding: gzip
Content-Length: 261
Content-Type: text/html; charset=iso-8859-1
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /w/index.php was not found on this server.</p>
<hr>
<address>Apache/2.2.11 (Ubuntu) PHP/5.2.6-3ubuntu4.1 with Suhosin-Patch
Server at localhost Port 80</address>
</body></html>
No trace of localhost, no trace of wikiSimpop ... and /w/index.php doesn't
exist for me ... it's api.php and not /w ...
*
Thanks in advance for you help !*
Seb.
Hello
I am writing for the first time and I don't quite know where the
appropriate place is to write this. I am working on the German
wikipedia and I ran into some problems using fixes.py, specifically I
had this edit: http://de.wikipedia.org/w/index.php?title=Deutsches_Reich_1933_bis_1945&dif…
the problem is here:
(r'\bdeutsche(r|n|) Reich\b', r'Deutsche\1 Reich'),
It seems to be the case that \b does not work with the German eszett,
whereas \< does work in my case. Should this be changed in all cases
where \b is used? Do you have other suggestions?
Greetings
Hannes
2009/6/17 <russblau(a)svn.wikimedia.org>:
> Revision: 6968
> Author: russblau
> Date: 2009-06-17 11:22:20 +0000 (Wed, 17 Jun 2009)
>
> Log Message:
> -----------
> Fix bugs affecting page deletion
>
> Modified Paths:
> --------------
> branches/rewrite/pywikibot/site.py
>
> Modified: branches/rewrite/pywikibot/site.py
> ===================================================================
> --- branches/rewrite/pywikibot/site.py 2009-06-16 21:18:20 UTC (rev 6967)
> +++ branches/rewrite/pywikibot/site.py 2009-06-17 11:22:20 UTC (rev 6968)
> @@ -1115,7 +1115,8 @@
> """
> query = api.PropertyGenerator("info|revisions",
> titles=page.title(withSection=False),
> - intoken=tokentype)
> + intoken=tokentype,
> + site=self)
> for item in query:
> if item['title'] != page.title(withSection=False):
> raise Error(
> @@ -2452,7 +2453,8 @@
> % e.__class__.__name__)
> if not self.logged_in(sysop=True):
> raise NoUsername("delete: Unable to login as sysop")
> - token = self.token("delete")
> + token = self.token(page, "delete")
> + self.lock_page(page)
> req = api.Request(site=self, action="delete", token=token,
> title=page.title(withSection=False),
> reason=summary)
>
>
>
> _______________________________________________
> Pywikipedia-svn mailing list
> Pywikipedia-svn(a)lists.wikimedia.org
> https://lists.wikimedia.org/mailman/listinfo/pywikipedia-svn
>
nicdumz(a)svn.wikimedia.org ha scritto:
> + def resolvemagicwords(self, wikitext):
> + """Replace the {{ns:xx}} marks in a wikitext with the namespace names"""
> +
> + defaults = []
> + for namespace in self.family.namespaces.itervalues():
> + value = namespace.get('_default', None)
> + if value:
> + if isinstance(value, list):
> + defaults += value
> + else:
> + defaults.append(value)
I don't write comments about SVN commits anymore because I am tired of
getting ignored and of people that doesn't read the mailing-list (and
not only) and have commit access. I have major open source projects for
wasting my time.
--
Francesco Cosoleto
«Non abbiamo tanto bisogno dell'aiuto degli amici, quanto della certezza
del loro aiuto». (Epicuro)
If you don't mind a suggestion, Nic, I think it is better to use the Wiki
server to resolve magic words than to do it on the client side; otherwise,
we continue to face the problem of our client struggling to keep up with
changes in namespaces, etc. Why not use the API "action=expandtemplates"
feature here? Or, better yet, stick with the rewrite branch. :-)
Russ
----- Original Message -----
From: <nicdumz(a)svn.wikimedia.org>
To: <pywikipedia-svn(a)lists.wikimedia.org>
Sent: Sunday, June 21, 2009 9:58 AM
Subject: [Pywikipedia-svn] SVN: [6978] trunk/pywikipedia/wikipedia.py
> Revision: 6978
> Author: nicdumz
> Date: 2009-06-21 13:58:28 +0000 (Sun, 21 Jun 2009)
>
> Log Message:
> -----------
> Adding a Site.resolvemagicwords member.
> For now, only resolves {{ns:xx}} words, but is meant to be expanded.
>
> This solves issue #2805572
>
> Modified Paths:
> --------------
> trunk/pywikipedia/wikipedia.py
>
> Modified: trunk/pywikipedia/wikipedia.py
> ===================================================================
> --- trunk/pywikipedia/wikipedia.py 2009-06-21 10:46:10 UTC (rev 6977)
> +++ trunk/pywikipedia/wikipedia.py 2009-06-21 13:58:28 UTC (rev 6978)
> @@ -1811,6 +1811,9 @@
> # from text before processing
> thistxt = removeDisabledParts(thistxt)
>
> + # resolve {{ns:-1}} or {{ns:Help}}
> + thistxt = self.site().resolvemagicwords(thistxt)
> +
> for match in Rlink.finditer(thistxt):
> title = match.group('title')
> title = title.replace("_", " ").strip(" ")
> @@ -5898,6 +5901,32 @@
> + '\s*:?\s*\[\[(.+?)(?:\|.*?)?\]\]',
> re.IGNORECASE | re.UNICODE | re.DOTALL)
>
> + def resolvemagicwords(self, wikitext):
> + """Replace the {{ns:xx}} marks in a wikitext with the namespace
> names"""
> +
> + defaults = []
> + for namespace in self.family.namespaces.itervalues():
> + value = namespace.get('_default', None)
> + if value:
> + if isinstance(value, list):
> + defaults += value
> + else:
> + defaults.append(value)
> +
> + named = re.compile(u'{{ns:(' + '|'.join(defaults) + ')}}', re.I)
> +
> + def replacenamed(match):
> + return self.normalizeNamespace(match.group(1))
> +
> + wikitext = named.sub(replacenamed, wikitext)
> +
> + numbered = re.compile('{{ns:(-?\d{1,2})}}', re.I)
> +
> + def replacenumbered(match):
> + return self.namespace(int(match.group(1)))
> +
> + return named.sub(replacenumbered, wikitext)
> +
> # The following methods are for convenience, so that you can access
> # methods of the Family class easier.
> def encoding(self):
>
>
>
> _______________________________________________
> Pywikipedia-svn mailing list
> Pywikipedia-svn(a)lists.wikimedia.org
> https://lists.wikimedia.org/mailman/listinfo/pywikipedia-svn
>
And I remember reverting francesco for the same reason. heh, sorry :)
2009/6/23 <russblau(a)svn.wikimedia.org>:
> Revision: 6989
> Author: russblau
> Date: 2009-06-22 15:26:32 +0000 (Mon, 22 Jun 2009)
>
> Log Message:
> -----------
> required imports (because global os is deleted during execution)
--
Nicolas Dumazet — NicDumZ [ nɪk.d̪ymz ]
I am trying to setup pywikipedia to work on my local wiki. I have tried to follow online steps plus steps within README-family.txt.
My test wiki is: http://localhost/default (it is not live anywhere).
It seems like I am having trouble with this line within default_family.py (my family file).
self.langs = { # REQUIRED
'en': 'localhost/default', # Include one line for each wiki in family
# in the format 'code': 'hostname',
}
I have tried many different possibilities but have been unsuccessful. Here is the message I receive with login.py:
login.py
Password for user PyWikipedialBot on default:en:
Logging in to default:en as PyWikipedialBot
Traceback (most recent call last):
File "C:\Documents and Settings\beebem\Desktop\pywikipedia\login.py", line 316, in <module>
main()
File "C:\Documents and Settings\beebem\Desktop\pywikipedia\login.py", line 312, in main
loginMan.login()
File "C:\Documents and Settings\beebem\Desktop\pywikipedia\login.py", line 248, in login
cookiedata = self.getCookie()
File "C:\Documents and Settings\beebem\Desktop\pywikipedia\login.py", line 166, in getCookie
response, data = self.site.postData(address, self.site.urlEncode(predata))
File "C:\Documents and Settings\beebem\Desktop\pywikipedia\wikipedia.py", line 4655, in postData
conn.endheaders()
File "C:\Python26\lib\httplib.py", line 868, in endheaders
self._send_output()
File "C:\Python26\lib\httplib.py", line 740, in _send_output
self.send(msg)
File "C:\Python26\lib\httplib.py", line 699, in send
self.connect()
File "C:\Python26\lib\httplib.py", line 683, in connect
self.timeout)
File "C:\Python26\lib\socket.py", line 498, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
socket.gaierror: [Errno 11001] getaddrinfo failed
Thank you,
Mary Beebe
alexsh(a)svn.wikimedia.org ha scritto:
> Revision: 6956
> Author: alexsh
> Date: 2009-06-12 14:28:43 +0000 (Fri, 12 Jun 2009)
>
> Log Message:
> -----------
> speedy_delete.py
> *Fix: delete reasons failure when using multiple project (tested on en.wikinews and zh.wikipedia)
> *MsgUp: CSD Categories from commons, incubator, meta and mediawiki.
> *MsgUp: Messages make multiple projects in delete_reasons, talk_deletion_msg, and deletion_messages.
1 commit instead of 3 or 2.
> + if self.delete_reasons.has_key(self.mySite.family.name):
> + if self.delete_reasons[self.mySite.family.name].has_key(page.site().lang):
> + localReasons = wikipedia.translate(page.site().lang, self.delete_reasons)
> + wikipedia.output(u'')
> + for key, reason in localReasons.iteritems():
extra spaces
> + wikipedia.output((key + ':').ljust(8) + reason)
> + wikipedia.output(u'')
> + reason = wikipedia.input(u'Please enter the reason for deletion, choose a default reason, or press enter for the suggested message:')
> + if localReasons.has_key(reason.strip()):
> + reason = localReasons[reason]
> + else:
> + reason = wikipedia.input(u'Please enter the reason for deletion, or press enter for the suggested message:')
> else:
> reason = wikipedia.input(u'Please enter the reason for deletion, or press enter for the suggested message:')
if A in dict and B in dict:
...
else:
reason ...
--
Francesco Cosoleto
«Non dee l'uomo, per maggiore amico, dimenticare li servigi ricevuti dal
minore». (Dante Alighieri, Convivio, II, 65)
alexsh(a)svn.wikimedia.org ha scritto:
> Revision: 6959
> Author: alexsh
> Date: 2009-06-13 03:31:53 +0000 (Sat, 13 Jun 2009)
>
> Log Message:
> -----------
> *UpNameSpace : anarchopedia, battlestarwiki, uncyclopedia and betawiki by update_namespaaces.py and testFamily.py
> *ReName: mac_wikicities_family.py -> mac_wikia_family.py by self.name not match with filename.
> *UpMsg: cross_allowed in wikipedia and wikiquote
1 commit instead of 3...
--
Francesco Cosoleto
"Resteranno però gli altri Achei lunghi capelli,
finché abbatteremo Troia: e se pure questi...
ma sì, sulle navi fuggite verso la patria terra!
Noi due, Stènelo e io, lotteremo, fino a che il termine
fatale d'Ilio troviamo, perché con nume propizio venimmo." (Omero)