Bugs item #3463037, was opened at 2011-12-20 10:40
Message generated for change (Comment added) made by valhallasw
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603138&aid=346303…
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: Closed
Resolution: None
Priority: 5
Private: No
Submitted By: ACarter (a1carter)
Assigned to: Nobody/Anonymous (nobody)
Summary: Can't create pages with ":" in title, namespaces
Initial Comment:
I am creating pages in a "Review:" namespace.
My script just adds "Review:" infront of the page title. (The line of code is
this : "newtitle = "Review:"+pagetitle")
When I try to do so, I get this:
File;C:\..\..\wikipedia.py, line 317, in _init_ raise InvalidTitle(u"Invalid title
'%s'" % title) pywikibot.exceptions.InvalidTitle: Invalid title ':'
I'm on r9782 (28 Nov)
Thanks
----------------------------------------------------------------------
Comment By: Merlijn S. van Deen (valhallasw)
Date: 2011-12-21 07:48
Message:
Thanks for posting your code. This is what happens:
newtitles = pagetitle # = 'Amsterdam'
newtitles2 = 'Review:'+newtitles # = 'Review:Amsterdam'
newredirects = [wikipedia.Page(mysite, title) for title in
newtitles2 ] # = [wikipedia.Page(mysite, title) for title in
'Review:Amsterdam'] = [wikipedia.Page(mysite, title) for title in ['R',
'e', 'v', 'i', 'e', 'w', ':', 'A',
...]]
which tries to create a Page object Page(mysite, ':'), which is obviously
illegal.
I'm not quite sure how your code is /supposed/ to work, but hopefully this
helps to understand what happens and how to prevent it.
----------------------------------------------------------------------
Comment By: ACarter (a1carter)
Date: 2011-12-21 01:07
Message:
Yes, sorry about that.
Same error with the latest release:
Traceback (most recent call last):
File "C:\...\...\create_reviews.py", line 47, in <module>
newredirects = [wikipedia.Page(mysite, title) for title in newtitles2 ]
File "C:\...\...\wikipedia.py", line 317, in __init__
raise InvalidTitle(u"Invalid title '%s'" % title )
pywikibot.exceptions.InvalidTitle: Invalid title ':'
My script:
pagetitle = page.title()
# condition for pages
if pagetitle.find(" ") > 0:
# new pges
newtitles = pagetitle
newtitles2 = 'Review:'+newtitles
suggestions = [">>> %s <<<" % x for x in
newtitles2]
newredirects = [wikipedia.Page(mysite, title) for title in
newtitles2 ]
I am working on a Wikia wiki, in english.
Thanks, and sorry about that.
----------------------------------------------------------------------
Comment By: Merlijn S. van Deen (valhallasw)
Date: 2011-12-20 13:16
Message:
Please update first to check if the bug is fixed in a more recent release.
Secondly, please post complete stack traces, *and* the relevant code in
your script
Thirdly, please check what the parameters are you are sending to the Page
object. What is the exact page title that causes this problem, what other
parameters are sent, on which wiki are you working? which language?
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603138&aid=346303…