Last modified: 2014-09-21 00:14:05 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T57133, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 55133 - Parsing error for Link instances
Parsing error for Link instances
Status: NEW
Product: Pywikibot
Classification: Unclassified
General (Other open bugs)
All All
: High normal
: ---
Assigned To: Pywikipedia bugs
Depends on:
Blocks: pwb20
  Show dependency treegraph
Reported: 2013-10-05 04:29 UTC by Kunal Mehta (Legoktm)
Modified: 2014-09-21 00:14 UTC (History)
4 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Description Kunal Mehta (Legoktm) 2013-10-05 04:29:59 UTC
Originally from:
Reported by: xqt
Created on: 2013-07-14 14:07:44.612000
Subject: Parsing error for Link instances
Original description:
I get a parsing error for Link.parse() e.g. for the following statements:

>>> import pwb; import pywikibot as wp
>>> l = wp.Link(u'w:de:Foo')
>>> l
Traceback (most recent call last):
  File "<pyshell#135>", line 1, in <module>
  File "pywikibot\", line 2931, in __repr__
    return ", %r)" % (self.title,
  File "pywikibot\", line 3101, in title
  File "pywikibot\", line 3007, in parse
    % self._text)
Error: Improperly formatted interwiki link 'w:de:Foo'

using wikipedia: instead of w: the Link is wrong:

>>> l = wp.Link(u'wikipedia:de:Foo')
>>> l'De:Foo', Site("de", "wikipedia"))

It works right for wikt: and wiktionary:
>>> l = wp.Link(u'wikt:de:Foo')
>>> l'Foo', Site("de", "wiktionary"))
>>> l = wp.Link(u'wikt:de:Foo')
>>> l'Foo', Site("de", "wiktionary"))
>>> l = wp.Link(u'wiktionary:de:Foo')
>>> l'Foo', Site("de", "wiktionary"))
Comment 1 Kunal Mehta (Legoktm) 2013-10-05 04:30:01 UTC
working for me, still a bug?
Comment 2 Ricordisamoa 2014-04-16 06:57:21 UTC
@Xqt: if you have set family = 'wikipedia' and mylang = 'de' in your, the parser may get confused about interwiki links to the same family.
Comment 3 xqt 2014-04-16 07:15:08 UTC
Anyway either u'w:de:Foo' or u'wikipedia:de:Foo' are valid links and Link.parse() should be able to deal with them
Comment 4 Gerrit Notification Bot 2014-09-03 21:49:02 UTC
Change 149629 had a related patch set uploaded by John Vandenberg:
Add basic tests for Link(), with 34 errors
Comment 5 Gerrit Notification Bot 2014-09-20 23:21:00 UTC
Change 149629 merged by jenkins-bot:
Add basic tests for Link(), with 20 errors
Comment 6 John Mark Vandenberg 2014-09-21 00:14:05 UTC
Tests in; time for some fixes.

Note You need to log in before you can comment on or make changes to this bug.