Bugs item #1999787, was opened at 2008-06-22 06:27
Message generated for change (Comment added) made by mpupat
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603138&aid=1999787&group_…
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Alex S.H. Lin (lin4h)
Assigned to: Nobody/Anonymous (nobody)
Summary: InvocationException in interwiki_graph.py
Initial Comment:
Version:
Microsoft Windows XP Professional with SP3
Pywikipedia [http] trunk/pywikipedia (r5604, Jun 21 2008, 20:20:16)
Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)]
installed Modules and softwares:pydot,graphviz.
command:interwiki.py -lang:zh -family:wikipedia "插花" -autonomous
It cannot write pictures and return these error:
======Aborted processing [[zh:插花]]======
Exception in thread Thread-2:
Traceback (most recent call last):
File "C:\Python25\lib\threading.py", line 486, in __bootstrap_inner
self.run()
File "D:\My Documents\SOURCE\pybot\trunk\pywikipedia\interwiki_graph.py", line
36, in run
if self.graph.write(filename, prog = 'dot', format = format):
File "build\bdist.win32\egg\pydot.py", line 1696, in write
dot_fd.write(self.create(prog, format))
File "build\bdist.win32\egg\pydot.py", line 1796, in create
status, stderr_output) )
InvocationException: Program terminated with status: 69. stderr follows: Error:
c:\docume~1\admini~1\locals~1\temp\tmpyfxn5k:2: syntax error near line 2
context: "he:蛂???蚳 蚺蚳???" >>> [URL=http: <<< //he.wikipedia.org/w/index.php
?useskin=monobook&title=D70X1.370093P-10191D7%D7%D7%D70X1.2F7000P-10228_D70X1.32
BA07P-10194D70X1.01DEF0P+6848D7%D7%D7D&redirect=no, shape=rectangle, fontsize=11
, style=filled, fillcolor=white];
----------------------------------------------------------------------
Comment By: Matthieu Pupat (mpupat)
Date: 2009-01-19 03:48
Message:
I did look at the issue and found that:
* you need to put some double-quotes around the URL address
* pydot does some processing on node names containing columns
Knowing this the following patch makes interwiki_graph work
49c49
< return (u'"%s:%s"' % (page.site().language(),
page.title())).encode('utf-8')
---
> return (u'"%s|%s"' % (page.site().language(),
page.title())).encode('utf-8')
53c53
< node.set_URL('http://%s%s' % (page.site().hostname(),
page.site().get_address(page.urlname())))
---
> node.set_URL('"http://%s%s' % (page.site().hostname(),
page.site().get_address(page.urlname())) + '"')
----------------------------------------------------------------------
Comment By: Matthieu Pupat (mpupat)
Date: 2009-01-18 05:16
Message:
Same thing here:
$ python ./interwiki.py -lang:fr Acadie
[...]
Which variant should be used [number, (n)one, (g)ive up] : Exception in
thread Thread-2:
Traceback (most recent call last):
File "/usr/lib/python2.5/threading.py", line 486, in __bootstrap_inner
self.run()
File "/home/almabot/pywikipedia/interwiki_graph.py", line 36, in run
if self.graph.write(filename, prog = 'dot', format = format):
File "/usr/lib/python2.5/site-packages/pydot.py", line 1696, in write
dot_fd.write(self.create(prog, format))
File "/usr/lib/python2.5/site-packages/pydot.py", line 1796, in create
status, stderr_output) )
InvocationException: Program terminated with status: 220. stderr follows:
Error: /tmp/tmpWpo-hB:2: syntax error near line 2
context: "lt:Akadija" >>> [URL=http: <<<
//lt.wikipedia.org/w/index.php?useskin=monobook&title=Akadija&redirect=no,
shape=octagon, fontsize=11, style=filled, fillcolor=white];
$ python ./version.py
Pywikipedia [http] trunk/pywikipedia (r6264, Jan 15 2009, 23:28:54)
Python 2.5.2 (r252:60911, Sep 30 2008, 15:41:38)
[GCC 4.3.2 20080917 (Red Hat 4.3.2-4)]
I hope this helps figuring out the issue.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603138&aid=1999787&group_…
Bugs item #1999787, was opened at 2008-06-22 06:27
Message generated for change (Comment added) made by mpupat
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603138&aid=1999787&group_…
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Alex S.H. Lin (lin4h)
Assigned to: Nobody/Anonymous (nobody)
Summary: InvocationException in interwiki_graph.py
Initial Comment:
Version:
Microsoft Windows XP Professional with SP3
Pywikipedia [http] trunk/pywikipedia (r5604, Jun 21 2008, 20:20:16)
Python 2.5.2 (r252:60911, Feb 21 2008, 13:11:45) [MSC v.1310 32 bit (Intel)]
installed Modules and softwares:pydot,graphviz.
command:interwiki.py -lang:zh -family:wikipedia "插花" -autonomous
It cannot write pictures and return these error:
======Aborted processing [[zh:插花]]======
Exception in thread Thread-2:
Traceback (most recent call last):
File "C:\Python25\lib\threading.py", line 486, in __bootstrap_inner
self.run()
File "D:\My Documents\SOURCE\pybot\trunk\pywikipedia\interwiki_graph.py", line
36, in run
if self.graph.write(filename, prog = 'dot', format = format):
File "build\bdist.win32\egg\pydot.py", line 1696, in write
dot_fd.write(self.create(prog, format))
File "build\bdist.win32\egg\pydot.py", line 1796, in create
status, stderr_output) )
InvocationException: Program terminated with status: 69. stderr follows: Error:
c:\docume~1\admini~1\locals~1\temp\tmpyfxn5k:2: syntax error near line 2
context: "he:蛂???蚳 蚺蚳???" >>> [URL=http: <<< //he.wikipedia.org/w/index.php
?useskin=monobook&title=D70X1.370093P-10191D7%D7%D7%D70X1.2F7000P-10228_D70X1.32
BA07P-10194D70X1.01DEF0P+6848D7%D7%D7D&redirect=no, shape=rectangle, fontsize=11
, style=filled, fillcolor=white];
----------------------------------------------------------------------
Comment By: Matthieu Pupat (mpupat)
Date: 2009-01-18 05:16
Message:
Same thing here:
$ python ./interwiki.py -lang:fr Acadie
[...]
Which variant should be used [number, (n)one, (g)ive up] : Exception in
thread Thread-2:
Traceback (most recent call last):
File "/usr/lib/python2.5/threading.py", line 486, in __bootstrap_inner
self.run()
File "/home/almabot/pywikipedia/interwiki_graph.py", line 36, in run
if self.graph.write(filename, prog = 'dot', format = format):
File "/usr/lib/python2.5/site-packages/pydot.py", line 1696, in write
dot_fd.write(self.create(prog, format))
File "/usr/lib/python2.5/site-packages/pydot.py", line 1796, in create
status, stderr_output) )
InvocationException: Program terminated with status: 220. stderr follows:
Error: /tmp/tmpWpo-hB:2: syntax error near line 2
context: "lt:Akadija" >>> [URL=http: <<<
//lt.wikipedia.org/w/index.php?useskin=monobook&title=Akadija&redirect=no,
shape=octagon, fontsize=11, style=filled, fillcolor=white];
$ python ./version.py
Pywikipedia [http] trunk/pywikipedia (r6264, Jan 15 2009, 23:28:54)
Python 2.5.2 (r252:60911, Sep 30 2008, 15:41:38)
[GCC 4.3.2 20080917 (Red Hat 4.3.2-4)]
I hope this helps figuring out the issue.
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603138&aid=1999787&group_…
Feature Requests item #1722782, was opened at 2007-05-21 17:21
Message generated for change (Comment added) made by aronsson
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603141&aid=1722782&group_…
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Priority: 5
Private: No
Submitted By: Byrial Ole Jensen (byrial)
Assigned to: Russell Blau (russblau)
Summary: interwiki.py should follow category redirect templates
Initial Comment:
Sometimes when a category is moved, a template like [[en:template:Template:Category redirect]] (see its interwiki links for similar templates in other languages) is left at the old category page.
It would be good if interwiki.py could check for the presence of a such template and follow the redirect to the new category as given by the template argument.
----------------------------------------------------------------------
Comment By: Lars Aronsson (aronsson)
Date: 2009-01-17 17:34
Message:
Could you describe how you measure this slowdown, and what level of
slowdown would be acceptable? All the code does is to test for strings
similar to {{category redirect | something}}, which shouldn't be much
slower than testing for #REDIRECT [[something]].
----------------------------------------------------------------------
Comment By: Russell Blau (russblau)
Date: 2009-01-15 15:45
Message:
aronsson: Although your patch works, it causes an unacceptable slowdown in
the loading of category pages. I have therefore reverted the change, and
will not implement this feature for the time being. I'll leave this open
in case anyone has a better idea.
----------------------------------------------------------------------
Comment By: Lars Aronsson (aronsson)
Date: 2009-01-12 23:22
Message:
The previous comment was a failed attempt to submit a patch. The same code
is available as the attached file mydiff. Most of this patch is a list of
template names, that originated in category_redirect.py and really should
move to family.py or some place like that.
What I've done is to add an "elif" branch in the two places, where
self.site.redirectRegex() is tested, so it also looks for these templates,
but only if we are in a category page. Maybe self.site shouldn't hand out a
regex, but instead provide the function that tests for redirects. Feel free
to refactor this.
----------------------------------------------------------------------
Comment By: Lars Aronsson (aronsson)
Date: 2009-01-10 02:41
Message:
Thanks, I hadn't even looked in category_redirect.py. For the moment, I
just copied the list of template names to my version of wikipedia.py so all
my changes are in one file. I have updated the list with more template
names (and more synonyms).
The detection of #REDIRECT in wikipedia.py is done in two places, using
self.site.redirectRegex() both in Page._getEditPage() and GetAll.oneDone().
These are the two places I added an "elif" branch to look for category
redirects. I don't fully understand why there needs to be two places to do
this test, but that's a matter of overall design. The naming of
redirectRegex() is also hardwired to the use of a single regex, which
doesn't scale to category redirects. Perhaps a refactoring would lead to
that function being renamed to isRedirect(). I think redirect detection
does belong in the Site object, since it depends on language-specific
synonyms to REDIRECT and to specific templates used for category redirects.
----------------------------------------------------------------------
Comment By: Russell Blau (russblau)
Date: 2009-01-09 14:17
Message:
category_redirect.py already contains a list of category redirect
templates, although only for a few sites. If it is desired to use this
capability in other bots, then the template lists should probably be moved
into the family files, and an is_category_redirect() method added to the
Category object in catlib.py, or alternatively to the Page object.
----------------------------------------------------------------------
Comment By: Lars Aronsson (aronsson)
Date: 2009-01-09 12:40
Message:
I now have some code that I believe solves this. But since I'm a beginner
in Python, I'd like someone more experienced to look at my code before it
is submitted.
----------------------------------------------------------------------
Comment By: Lars Aronsson (aronsson)
Date: 2009-01-09 01:46
Message:
The previous comment was by me. I don't know why I wasn't logged in.
----------------------------------------------------------------------
Comment By: Nobody/Anonymous (nobody)
Date: 2009-01-09 01:43
Message:
Implementing this feature involves several steps.
First the template needs to be detected. This is similar to isDisambig()
in wikipedia.py. Perhaps that function should also require isCategory(), so
the template is only detected when used in category pages. Unfortunately,
there is no equivalent to the MediaWiki:Disambiguationspage to help us find
out what the template name is in each language, so we have to list the
template translations for each language. I think that should be manageable.
I propose the new function be called isCategoryRedirect(). Then this
function needs to be introduced where isRedirect() is used. Or perhaps
isRedirect() should call it? That would save a lot of work.
Are there some situations where it would be harmful to detect this
template? Should the use of the new function be configurable?
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603141&aid=1722782&group_…
Hello,
I am quite raw to pywikipedia,
I need to get list of cat articles
it works ok on wikipedia, but not on the wiki of my interest
though it gets/writes page text from this wiki ok for me
http://studento.vikis.lt/wiki/index.php/Kategorija:Programa
configs:
http://popmokslas.projektas.lt/etc/pywikipedia/
import catlib
cat = catlib.Category(site,u'Programa')
print cat
for page in cat.articles(recurse = True):
print page
outputs:
[[Kategorija:Programa]]
Getting [[Kategorija:Programa]]...
the same with pagegenerators.CategorizedPageGenerator(cat)
---
Any ideas?
Thanks in advance
--
Jurgis Pralgauskis
Don't worry, be happy and make things better ;)
I've been working on implementing the category redirect detection suggested
by Lars Aronsson
(https://sourceforge.net/tracker/?func=detail&atid=603141&aid=1722782&group_…),
but I have a question for other developers. A category redirect is
implemented as a "soft redirect"; that is, a template is placed on the page
marking it as a redirect, but it does not use the #REDIRECT magic word of
the MediaWiki software, so the server doesn't treat it as a redirect. As
proposed, a category page (p) that contains a "soft" category redirect would
return True both to p.isRedirectPage() and to p.is_category_redirect(); the
only way to tell hard redirects apart from soft redirects would be to do
something like:
if p.isRedirectPage() and not p.is_category_redirect():
handle_hard_redirects_only()
The question is, if pages that are not hard redirects return True to
p.isRedirectPage(), will this break anything else?
Russ
Revision: 6264
Author: a_engels
Date: 2009-01-15 23:28:54 +0000 (Thu, 15 Jan 2009)
Log Message:
-----------
My last edit accidentily changed the default from i to a; corrected this
Modified Paths:
--------------
trunk/pywikipedia/spellcheck.py
Modified: trunk/pywikipedia/spellcheck.py
===================================================================
--- trunk/pywikipedia/spellcheck.py 2009-01-15 22:39:04 UTC (rev 6263)
+++ trunk/pywikipedia/spellcheck.py 2009-01-15 23:28:54 UTC (rev 6264)
@@ -20,6 +20,7 @@
a: This word is correct; add it to the list of known words
c: The uncapitalized form of this word is correct; add it
i: Do not edit this word, but do also not add it to the list
+ p: Do not edit this word, and consider it correct for this page only
r: Replace the word, and add the replacement as a known alternative
s: Replace the word, but do not add the replacement
*: Edit the page using the gui
@@ -151,7 +152,7 @@
wikipedia.output(u"a: Add '%s' as correct"%word)
if word[0].isupper():
wikipedia.output(u"c: Add '%s' as correct"%(uncap(word)))
- wikipedia.output(u"i: Ignore once")
+ wikipedia.output(u"i: Ignore once (default)")
wikipedia.output(u"p: Ignore on this page")
wikipedia.output(u"r: Replace text")
wikipedia.output(u"s: Replace text, but do not save as alternative")
@@ -159,6 +160,7 @@
wikipedia.output(u"*: Edit by hand")
wikipedia.output(u"x: Do not check the rest of this page")
answer = wikipedia.input(u":")
+ if answer == "": answer = "i"
if answer in "aAiIpP":
correct = word
if answer in "aA":