Page MenuHomePhabricator

i18n.messages_available and twget_keys does not work on Python 3 with empty i18n package
Closed, ResolvedPublic

Description

Python 3 treats an empty i18n directory as an implicit namespace package (PEP 0420).

This causes i18n.messages_available to return True and twget to cause a AttributeError:

File "/home/ubuntu/pywikibot-core/tests/l10n_tests.py", line 67, in __new__
    keys = i18n.twget_keys(package)
  File "/home/ubuntu/pywikibot-core/pywikibot/i18n.py", line 619, in twget_keys
    pathname = os.path.join(os.path.dirname(mod.__file__), package)
AttributeError: 'module' object has no attribute '__file__'

Event Timeline

jayvdb raised the priority of this task from to Needs Triage.
jayvdb updated the task description. (Show Details)
jayvdb added projects: Pywikibot, Pywikibot-tests.
jayvdb subscribed.
jayvdb renamed this task from i18n.messages_available does not work on Python 3 to i18n.messages_available and twget_keys does not work on Python 3 with empty i18n package.Aug 25 2015, 10:07 AM
jayvdb updated the task description. (Show Details)
jayvdb set Security to None.

Change 233688 had a related patch set uploaded (by John Vandenberg):
Fix missing i18n git submodule on Python 3

https://gerrit.wikimedia.org/r/233688

Change 233688 merged by jenkins-bot:
Fix missing i18n git submodule on Python 3

https://gerrit.wikimedia.org/r/233688

jayvdb claimed this task.