Bugs item #1821360, was opened at 2007-10-27 22:50 Message generated for change (Comment added) made by rotemliss You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=603138&aid=1821360...
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: André Malafaya Baptista (malafaya) Assigned to: Nobody/Anonymous (nobody) Summary: cosmetic_changes.py crashes
Initial Comment: Trace below should be self-explanatory:
cosmetic_changes.py -lang:pt Portugal
Checked for running processes. 2 processes currently running, including the current process. ATTENTION: You can run this script as a stand-alone for testing purposes. However, the changes are that are made are only minor, and other users might get angry if you fill the version histories and watchlists with such irrelevant changes. Do you really want to continue? ([y]es, [N]o) y Getting 1 pages from wikipedia:pt...
Portugal <<<
Traceback (most recent call last): File "D:\Work\pywikipediabot-HEAD\pywikipedia\cosmetic_changes.py", line 398, in <module> main() File "D:\Work\pywikipediabot-HEAD\pywikipedia\cosmetic_changes.py", line 394, in main bot.run() File "D:\Work\pywikipediabot-HEAD\pywikipedia\cosmetic_changes.py", line 359, in run self.treat(page) File "D:\Work\pywikipediabot-HEAD\pywikipedia\cosmetic_changes.py", line 340, in treat changedText = ccToolkit.change(page.get()) File "D:\Work\pywikipediabot-HEAD\pywikipedia\cosmetic_changes.py", line 88, i n change text = self.cleanUpLinks(text) File "D:\Work\pywikipediabot-HEAD\pywikipedia\cosmetic_changes.py", line 259, in cleanUpLinks text = wikipedia.replaceExcept(text, linkR, handleOneLink, ['comment', 'math ', 'nowiki', 'pre', 'startspace']) File "D:\Work\pywikipediabot-HEAD\pywikipedia\wikipedia.py", line 2813, in rep laceExcept new = new.replace('\n', '\n') AttributeError: 'function' object has no attribute 'replace'
----------------------------------------------------------------------
Comment By: Rotem Liss (rotemliss) Date: 2007-10-29 13:44
Message: Logged In: YES user_id=1327030 Originator: NO
The problem in wikipedia.py, in the function replaceExcept. "new" may be either function or string (or unicode string), but in line 2813, the replace method is called (if the OS is Win32), without knowing if it is a function or a string. The code block in lines 2806-2813 should be moved down, after the "except TypeError" part, where it is known for sure that "new" is a string.
----------------------------------------------------------------------
You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=603138&aid=1821360...