Bugs item #3199823, was opened at 2011-03-04 19:00
Message generated for change (Settings changed) made by xqt
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603138&aid=319982…
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: Fixed
Priority: 5
Private: No
Submitted By: Daniel Barrett (djbarrett)
Assigned to: xqt (xqt)
Summary: redirect.py crash: TypeError: __import__() takes no...
Initial Comment:
redirect.py immediately crashes with:
$ sudo python redirect.py broken
Traceback (most recent call last):
File "redirect.py", line 799, in ?
main()
File "redirect.py", line 795, in main
bot.run()
File "redirect.py", line 713, in run
self.delete_broken_redirects()
File "redirect.py", line 484, in delete_broken_redirects
reason = i18n.twtranslate(self.site, reason_broken)
File "/usr/local/pywikipedia/pywikibot/i18n.py", line 220, in twtranslate
transdict = getattr(__import__("i18n", fromlist=[package]), package).msg
TypeError: __import__() takes no keyword arguments
$ python version.py
Pywikipedia [http] trunk/pywikipedia (r9018, 2011/03/02, 06:46:39)
Python 2.4.3 (#1, Sep 3 2009, 15:37:37)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-46)]
config-settings:
use_api = True
use_api_login = True
unicode test: ok
----------------------------------------------------------------------
Comment By: Daniel Barrett (djbarrett)
Date: 2011-05-09 21:50
Message:
The previous comment was from me, the logger of the bug.
----------------------------------------------------------------------
Comment By: Nobody/Anonymous (nobody)
Date: 2011-05-09 21:49
Message:
Confirmed that the crash is gone in Python 2.4.3. Thank you!
The logging bug pointed out by valhallasw is still present, but that
should probably be a different ticket.
----------------------------------------------------------------------
Comment By: xqt (xqt)
Date: 2011-05-09 21:16
Message:
Bug raised on trunk version not at rewrite. I fixed it there with r9227 for
2.4 compatibility and tested it with py 2.7.1. Please give me any response
whether it works.
----------------------------------------------------------------------
Comment By: Merlijn S. van Deen (valhallasw)
Date: 2011-03-05 17:04
Message:
Ah, that is annoying indeed. The logging issue is a bug though, I think -
there should be a config option to set the path to store the logs.
By the way - were you using the rewrite on python 2.4 before? If it worked
before, this might be a reason to write a compatibility layer or something
like that.
----------------------------------------------------------------------
Comment By: Daniel Barrett (djbarrett)
Date: 2011-03-04 20:38
Message:
Thanks for your note. Python 2.4 is the standard issue on CentOS 5 Linux,
so it may be a while before we can upgrade our machines.
As for "sudo", thanks for your comment & concern. The sudo is necessary
because Pywikipedia is installed in /usr/local/pywikipedia and it writes
its logs to /usr/local/pywkipedia/logs, which is protected.
----------------------------------------------------------------------
Comment By: Merlijn S. van Deen (valhallasw)
Date: 2011-03-04 20:26
Message:
Hi Daniel,
This parameter was added in python 2.5. As far as I know, no steps have
been taken in the rewrite to ensure python <= 2.4 compatibility -- you will
probably run into more problems, even if this specific issue is fixed. I
would strongly suggest upgrading to 2.5.
As a secondary note - why are you using 'sudo python'? Pywikipediabot has
not been written to be 'safe to use as root' - there might be bugs that
will allow an attacker to take over your computer if you run it as root.
Best regards,
----------------------------------------------------------------------
Comment By: Daniel Barrett (djbarrett)
Date: 2011-03-04 19:02
Message:
"python redirect.py double" also crashes:
$ sudo python redirect.py double
Retrieving special page...
Retrieved 107 redirects from special page.
>>
ASP.Net precompile <<<
Links to: [[
ASP.Net precompiler]].
Links to: [[
ASP.Net precompilation]].
Traceback (most recent call last):
File "redirect.py", line 799, in ?
main()
File "redirect.py", line 795, in main
bot.run()
File "redirect.py", line 711, in run
self.fix_double_redirects()
File "redirect.py", line 539, in fix_double_redirects
self.fix_1_double_redirect(redir_name)
File "redirect.py", line 664, in fix_1_double_redirect
summary = i18n.twtranslate(self.site, msg_double) \
File "/usr/local/pywikipedia/pywikibot/i18n.py", line 220, in
twtranslate
transdict = getattr(__import__("i18n", fromlist=[package]),
package).msg
TypeError: __import__() takes no keyword arguments
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=603138&aid=319982…