Page MenuHomePhabricator

Pywikipedia throws "title for namespace 118 in language ur unknown" error
Closed, ResolvedPublic

Description

Hi, Pywikipedia throws following error here, please fix it. Thanks!

  File "/data/project/-/pywikipedia/wikipedia.py", line 1865, in getReferences
    pg = Page(self.site(), blp['title'], defaultNamespace=blp['ns'])
  File "/data/project/-/pywikipedia/wikipedia.py", line 450, in __init__
    t = u'%s:%s' % (self._site.namespace(self._namespace), t)
  File "/data/project/-/pywikipedia/wikipedia.py", line 9391, in namespace
    return self.family.namespace(self.lang, num, all=all)
  File "/data/project/-/pywikipedia/family.py", line 4132, in namespace
    % (ns_number, code))
KeyError: 'ERROR: title for namespace 118 in language ur unknown'

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptSep 29 2016, 2:28 AM
Xqt triaged this task as Low priority.Sep 29 2016, 4:28 AM
Xqt added a project: Pywikibot-compat.
Xqt added a subscriber: Xqt.

Please provide the whole traceback and your command line. Also the result of version.py would help.

Is it possible to you to join to core branch with your bot? compat is likely deprecated.

Restricted Application added a subscriber: pywikibot-bugs-list. · View Herald TranscriptSep 29 2016, 4:28 AM
Xqt added a comment.Sep 29 2016, 5:36 AM

btw you may use update_namespace.py to fix it.

Change 313355 had a related patch set uploaded (by Xqt):
[bugfix] update some namespaces aliases

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

Please provide the whole traceback and your command line. Also the result of version.py would help.
Is it possible to you to join to core branch with your bot? compat is likely deprecated.

I have provided whole traceback.
Today i run git pull command so latest version installed in my directory.

And also following warnings while running redirect.py

WARNING: Outdated family file wikipedia: namespace['ur'][-2] is 'وسیط', but should be 'میڈیا'
WARNING: Outdated family file wikipedia: namespace['ur'][6] is 'ملف', but should be 'فائل'
WARNING: Outdated family file wikipedia: namespace['ur'][7] is 'تبادلۂ خیال ملف', but should be 'تبادلۂ خیال فائل'
WARNING: Missing namespace in family file wikipedia: namespace['ur'][102] (it is set to 'کتاب')
WARNING: Missing namespace in family file wikipedia: namespace['ur'][103] (it is set to 'تبادلۂ خیال کتاب')
WARNING: Missing namespace in family file wikipedia: namespace['ur'][118] (it is set to 'مسودہ')
WARNING: Missing namespace in family file wikipedia: namespace['ur'][119] (it is set to 'تبادلۂ خیال مسودہ')
WARNING: Missing namespace in family file wikipedia: namespace['ur'][2300] (it is set to 'آلہ')
WARNING: Missing namespace in family file wikipedia: namespace['ur'][2301] (it is set to 'تبادلۂ خیال آلہ')
WARNING: Missing namespace in family file wikipedia: namespace['ur'][2302] (it is set to 'تعریف آلہ')
WARNING: Missing namespace in family file wikipedia: namespace['ur'][2303] (it is set to 'تبادلۂ خیال تعریف آلہ')
WARNING: Missing namespace in family file wikipedia: namespace['ur'][2600] (it is set to 'موضوع')

Is it possible to you to join to core branch with your bot? compat is likely deprecated.

When i trying to run a script e.g clean sandbox.py, it gives following error:

tools.-@tools-bastion-03:~/pycore$ python pwb.py clean_sandbox.py -simulate
WARNING: Skipped '/data/project/-/pycore/user-config.py': owned by someone else.
WARNING: family and mylang are not set.
Defaulting to family='test' and mylang='test'.
Traceback (most recent call last):
  File "pwb.py", line 270, in <module>
    if not main():
  File "pwb.py", line 264, in main
    run_python_file(filename, [filename] + args, argvu, file_package)
  File "pwb.py", line 109, in run_python_file
    main_mod.__dict__)
  File "./scripts/clean_sandbox.py", line 294, in <module>
    main()
  File "./scripts/clean_sandbox.py", line 266, in main
    local_args = pywikibot.handle_args(args)
  File "/data/project/-/pycore/pywikibot/bot.py", line 818, in handle_args
    writeToCommandLogFile()
  File "/data/project/-/pycore/pywikibot/bot.py", line 943, in writeToCommandLogFile
    command_log_filename = config.datafilepath('logs', 'commands.log')
  File "/data/project/-/pycore/pywikibot/config2.py", line 828, in datafilepath
    return makepath(os.path.join(base_dir, *filename))
  File "/data/project/-/pycore/pywikibot/config2.py", line 816, in makepath
    os.makedirs(dpath)
  File "/usr/lib/python2.7/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/data/project/-/pycore/logs'
<type 'exceptions.OSError'>
CRITICAL: Waiting for 1 network thread(s) to finish. Press ctrl-c to abort
Xqt added a comment.EditedSep 29 2016, 3:20 PM

There is a patch ready for review in https://gerrit.wikimedia.org/r/313355
which includes a lot of missing namespace aliases in compat. Please try and review it.

For the second problem I'll created a new task in T146996.

Change 313355 had a related patch set uploaded (by Xqt):
[bugfix] update some namespaces aliases

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

Change 313355 merged by jenkins-bot:
[bugfix] update some namespaces aliases

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

Xqt closed this task as Resolved.Oct 28 2016, 4:13 PM
Xqt claimed this task.