Last modified: 2014-11-09 13:28:24 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 T73817, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 71817 - if [[file:]] exists in the page Cosmetic changes.py will crash
if [[file:]] exists in the page Cosmetic changes.py will crash
Status: NEW
Product: Pywikibot
Classification: Unclassified
Cosmetic changes (Other open bugs)
core-(2.0)
All All
: Unprioritized major
: ---
Assigned To: Pywikipedia bugs
: testme
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2014-10-08 17:45 UTC by reza1615
Modified: 2014-11-09 13:28 UTC (History)
2 users (show)

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


Attachments

Description reza1615 2014-10-08 17:45:46 UTC
If [[file:]] (or other namespaces) exists in the page Cosmetic_changes.py will crash
The error:

Traceback (most recent call last):
  File "pwb.py", line 164, in <module>
    run_python_file(fn, argv, argvu)
  File "pwb.py", line 69, in run_python_file
    exec(compile(source, filename, "exec"), main_mod.__dict__)
  File "scripts/cosmetic_changes.py", line 971, in <module>
    main()
  File "scripts/cosmetic_changes.py", line 965, in main
    bot.run()
  File "/home/reza/pycore/pywikibot/bot.py", line 939, in run
    self.treat(page)
  File "scripts/cosmetic_changes.py", line 904, in treat
    changedText = ccToolkit.change(page.get())
  File "scripts/cosmetic_changes.py", line 228, in change
    new_text = self._change(text)
  File "scripts/cosmetic_changes.py", line 221, in _change
    text = self.safe_execute(method, text)
  File "scripts/cosmetic_changes.py", line 199, in safe_execute
    result = method(text)
  File "scripts/cosmetic_changes.py", line 548, in cleanUpLinks
    'startspace'])
  File "/home/reza/pycore/pywikibot/textlib.py", line 224, in replaceExcept
    replacement = new(match)
  File "scripts/cosmetic_changes.py", line 442, in handleOneLink
    namespace = page.namespace()
  File "/home/reza/pycore/pywikibot/page.py", line 154, in namespace
    return self._link.namespace
  File "/home/reza/pycore/pywikibot/page.py", line 4160, in namespace
    self.parse()
  File "/home/reza/pycore/pywikibot/page.py", line 4137, in parse
    % self._text)
pywikibot.exceptions.Error: Invalid link (no page title): 'file:'
<class 'pywikibot.exceptions.Error'>
CRITICAL: Waiting for 1 network thread(s) to finish. Press ctrl-c to abort
Comment 2 Fabian 2014-10-09 19:31:51 UTC
Okay https://gerrit.wikimedia.org/r/161671/ does indirectly fix this. The problem is that Link.parse() raises an Error and not InvalidTitle exception. If it'd raise an InvalidTitle, cosmetic_changes.py would work fine.
Comment 3 John Mark Vandenberg 2014-11-09 13:28:24 UTC
Iec4f32fdefde15b2330dbb191fb3bbb0d04803e2 was merged.  We should add a test case for this, if one doesnt already exist.

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


Navigation
Links