https://bugzilla.wikimedia.org/show_bug.cgi?id=67488
Bug ID: 67488
Summary: Cache broken with non-ascii username/user namespace
Product: Pywikibot
Version: core (2.0)
Hardware: All
OS: All
Status: NEW
Severity: normal
Priority: Unprioritized
Component: General
Assignee: Pywikipedia-bugs(a)lists.wikimedia.org
Reporter: valhallasw(a)arctus.nl
CC: jayvdb(a)gmail.com
Web browser: ---
Mobile Platform: ---
Reported on IRC.
Password for user UserBot on mywiki:ar (no characters will be shown):
Logging in to mywiki:ar as UserBot
Could not load cache: UnicodeDecodeError('ascii', 'Site("ar",
"mywiki")User(\xd9\x85\xd8\xb3\xd8\xaa\xd8\xae\xd8\xaf\xd9\x85:UserBot)[(\'action\',
\'paraminfo\'), (\'format\', \'json\'), (\'maxlag\',
\'5\'), (\'querymodules\',
\'info|revisions\')]', 31, 32, 'ordinal not in range(128)')
Traceback (most recent call last):
File "pwb.py", line 153, in <module>
run_python_file(fn, argv, argvu)
File "pwb.py", line 67, in run_python_file
exec(compile(source, filename, "exec"), main_mod.__dict__)
File "scripts/pagefromfile.py", line 274, in <module>
main()
File "scripts/pagefromfile.py", line 271, in main
bot.run()
File "scripts/pagefromfile.py", line 85, in run
self.save(title, contents)
File "scripts/pagefromfile.py", line 141, in save
page.save(comment, minor=self.getOption('minor'))
File "/Users/user/shell/core/pywikibot/__init__.py", line 423, in wrapper
return method(*__args, **__kw)
File "/Users/user/shell/core/pywikibot/page.py", line 886, in save
**kwargs)
File "/Users/user/shell/core/pywikibot/page.py", line 896, in _save
watch=watchval, bot=botflag, **kwargs)
File "/Users/user/shell/core/pywikibot/site.py", line 557, in callee
return fn(self, *args, **kwargs)
File "/Users/user/shell/core/pywikibot/site.py", line 2787, in editpage
lastrev = page.latestRevision()
File "/Users/user/shell/core/pywikibot/page.py", line 364, in latestRevision
self.site.loadrevisions(self)
File "/Users/user/shell/core/pywikibot/site.py", line 1922, in loadrevisions
step=step, total=total, **rvargs)
File "/Users/user/shell/core/pywikibot/site.py", line 693, in _generator
gen = gen_class(type_arg, site=self, **args)
File "/Users/user/shell/core/pywikibot/data/api.py", line 885, in __init__
QueryGenerator.__init__(self, prop=prop, **kwargs)
File "/Users/user/shell/core/pywikibot/data/api.py", line 560, in __init__
self.update_limit() # sets self.prefix
File "/Users/user/shell/core/pywikibot/data/api.py", line 654, in
update_limit
for param in self._modules[mod].get("parameters", []):
File "/Users/user/shell/core/pywikibot/data/api.py", line 604, in _modules
data = paramreq.submit()
File "/Users/user/shell/core/pywikibot/data/api.py", line 510, in submit
self._write_cache(self._data)
File "/Users/user/shell/core/pywikibot/data/api.py", line 503, in
_write_cache
with open(self._cachefile_path(), 'wb') as f:
File "/Users/user/shell/core/pywikibot/data/api.py", line 478, in
_cachefile_path
return os.path.join(self._get_cache_dir(), self._create_file_name())
File "/Users/user/shell/core/pywikibot/data/api.py", line 474, in
_create_file_name
self._uniquedescriptionstr().encode('utf-8')
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd9 in position 31:
ordinal not in range(128)
<type 'exceptions.UnicodeDecodeError'>
CRITICAL: Waiting for 1 network thread(s) to finish. Press ctrl-c to abort
We should add a test with a non-ascii username/namespace (or we should just
test on arwiki instead of enwiki :-p)
--
You are receiving this mail because:
You are the assignee for the bug.